私のアプリでは、数秒後にネットワーク接続が遅すぎるとエラーメッセージを表示したいと考えています。私はどのようにこれを実装すべきですか?一定時間後にアクションをトリガする方法は?
-(void)setProjectID:(NSString *)newProject {
[self willChangeValueForKey:@"projectID"];
[projectID release];
projectID = [newProject copy];
[self didChangeValueForKey:@"projectID"];
// Since we have an ID, now we need to load it
NSInvocation *returnInvocation = [NSInvocation invocationWithMethodSignature:
[Detail instanceMethodSignatureForSelector:@selector(configureView:)]];
[returnInvocation setTarget:self];
[returnInvocation setSelector:@selector(configureView:)];
[returnInvocation retainArguments];
fetch = [[WBWDocumentFetcher alloc] init];
[fetch retrieveDocument:[NSURL wb_URLForTabType:PROJECT_DETAILS inProject:projectID] returnBy:returnInvocation];
}
-(void)configureView:(NSDictionary *)serverResult
{
}
おかげで、あなたはperformSelector:afterDelay:
または可能性performSelector:withObject:afterDelay:
を使用したい
このコードではこのコードを使用する必要があります。私は自分のコードで何も見ていない。 – Ashutosh
また、ページが読み込まれているかどうかを確認する必要がありますか? – Ashutosh
コードを一切見ずに、言うのはむしろ難しいです。たとえば、 'UIWebView'を使用している場合、おそらく' -webViewDidStartLoad: 'に入れたいと思うかもしれません。 – PengOne