UITableViewDataSource
fromプロトコルとプロトコルを実装するカスタムViewControllerがありUITableViewDelegate
ます。(私のviewDidLoad
メソッドで)テーブルのデータをロードするときに、aNSOperationQueue
とaを作成し、NSInvocationOperation
それをキューに追加します。アクティビティインジケーターを表示してviewDidLoad
終了します。
操作に使用されたメソッドは、アクティビティインジケーターのアニメーションを終了します。
NSLogでは操作のメソッドが返されたように見えますが、操作が完了すると、操作が実際に完了するまでに5〜7秒の休止があることに気付きました。
Instrumentsを使用して一時停止が発生している場所を特定しようとしましたが、CPU時間のほとんどがシステムライブラリに費やされているため、それからはわかりません。
編集 これは省略形です:
@implementation MyViewController
@synthesize ...
- (void)viewDidLoad {
[super viewDidLoad];
self.opsQueue = [[NSOperationQueue alloc] init];
NSInvocationOperation *aiStartOp = [[[NSInvocationOperation alloc]
initWithTarget:self
selector:@selector(showActivityIndicators)
object:nil] autorelease];
[self.opsQueue addOperation:aiStartOp];
NSInvocationOperation *dataOp = [[[[NSInvicationOperation alloc]
initWithTarget:self
selector:@selector(dataUpdate)
object:nil] autorelease];
[dataOp addDependency aiStartOp];
[self.opsQueue addOperation:dataOp];
NSInvicationOperation *aiStopOp = [[[NSInvicationOperation alloc]
initWithTarget:self
selector:@selector(hideActivityIndicators)
object:nil] autorelease];
[aiStopOp addDependency:dataOp];
[self.opsQueue addOperation:aiStopOp];
}
/* other stuff */
@end
明確にするために、キュー内の最後の操作は次のとおりです。
- (void)hideActivityIndicators {
DLog(@"hiding activity indicator");
self.portraitChartProgressView.hidden = YES;
[self.portraitChartProgressIndicator stopAnimating];
self.landscapeProgressView.hidden = NO;
[self.landscapeProgressIndicator startAnimating];
}
ログに表示されるのは、上記のログメッセージの出力であり、その後5秒間休止し、最後にインジケーターが非表示になっているビューが続きます。
何か案は?