正如埃裏克說,在他的評論中,使用MBProgressHud裝載觀點..
添加HUD作爲窗口的子視圖。
// Should be initialized with the windows frame so the HUD disables all user input by covering the entire screen
HUD = [[MBProgressHUD alloc] initWithWindow:[UIApplication sharedApplication].keyWindow];
// Add HUD to screen
[self.view.window addSubview:HUD];
// Register for HUD callbacks so we can remove it from the window at the right time
HUD.delegate = self;
HUD.labelText = NSLocalizedString(@"Loading Workbench", nil);
HUD.detailsLabelText = NSLocalizedString(@"please wait", nil);
// Show the HUD while the provided method executes in a new thread
[HUD showWhileExecuting:@selector(loadWorkbench:) onTarget:self withObject:nil animated:YES];
添加下面的委託方法:
- (void)hudWasHidden {
// Remove HUD from screen
[HUD removeFromSuperview];
// add here the code you may need
}
而且不要忘記在相應的頭文件添加MBProgressHUDDelegate
。
無法從代碼中判斷出你在做什麼,但是你在使用UIActivityIndicatorView嗎?我猜你需要分配一個uiactivityindicatorview,將它作爲子視圖設置爲當前視圖的框架,然後開始動畫。 – Augie
閱讀說明。 – user1302602
使用MBProgressHud在viewdidload中顯示加載視圖,然後在圖像處理完成後隱藏它。 – Eric