ユーザーがビューを切り替えたときに次のビューが読み込まれていること、またはボタンをクリックすると別のビューに移動したことを示すメッセージを表示する UIActivityIndicatorView があります。UIActivityIndicatorView を追加して、API から現在のビューに表示されるデータをフェッチして、ユーザーの操作が有効になる前に完了できるようにしました。UIActivityIndicatorView は、現在のビューがバックグラウンドで読み込まれるときに待機メッセージで正しくアニメーション化されます。ただし、ビューの読み込みが完了した後でも、UIActivityIndicatorView はアニメーションを停止せず、永遠に継続します!! [アニメーションの停止] と removefromSuperview の両方を試しましたが、どちらも機能していないようです。この問題を早急に解決する必要があります。
コードは次のとおりです。 -(void)showWorkInProgress { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
progressAlert = [[UIAlertView alloc] initWithTitle:@"Loading Data"
message:@"Please wait..."
delegate: self
cancelButtonTitle: nil
otherButtonTitles: nil];
activityView = [[UIActivityIndicatorView alloc]
initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; activityView.frame = CGRectMake(139.0f-18.0f, 80.0f, 37.0f, 37.0f); [progressAlert addSubview:activityView];
[activityView startAnimating];
[progressAlert show];
[pool drain];
} - (無効)viewDidLoad {
self.title = @"WordLife";
UIImage *image = [UIImage imageNamed: @"cena.png"];
UIImageView *imageview = [[UIImageView alloc] initWithImage: image];
self.navigationItem.titleView = imageview;
[imageview release];
self.navigationItem.leftBarButtonItem.title = @"Back";
[activityView removeFromSuperview];
activityView = nil;
[super viewDidLoad];
}