我已經成立了一個標籤佈局我的iPhone應用程序的計算/處理數據,我想執行一些相當激烈計算(可能需要幾秒鐘才能獲得結果),當用戶選擇一個的選項卡。使用UIAlertView中等待
最初,它會出現在執行數字運算時iphone會掛在原始選項卡上。
我試着添加一個UIAlertView作爲一些眼睛糖果,但我漸漸灰暗了幾秒鐘,然後計算完成後,快速出現/視圖消失。我想看到的是UIAlertView中出現/動畫當用戶觸摸選項卡,然後消失,一旦計算完成
- (void)viewDidAppear:(BOOL)animated
{
UIAlertView *baseAlert = [[[UIAlertView alloc] initWithTitle:@"Calculating" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:nil, nil]autorelease];
[baseAlert show];
UIActivityIndicatorView *aiv = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
aiv.center = CGPointMake(baseAlert.bounds.size.width /2.0f, baseAlert.bounds.size.height - 40.0f);
[aiv startAnimating];
[baseAlert addSubview:aiv];
[aiv release];
/*** calculation and display routines***/
[baseAlert dismissWithClickedButtonIndex:0 animated:YES];
}
我已經看到this post,但我似乎無法弄清楚如何將其應用於我的案例。
那是光榮的!謝謝 – Rasman 2011-05-29 21:43:20