誰でもperformSelectorInBackground
でお手伝いできますか?私はperformSelectorInBackground
の更新されたデータでテーブルをリロードしたい。IPhone + performselector in background
答えて
バックグラウンドスレッドでデータを取得するだけで、メインスレッドでデータを取得してテーブルビューを更新するとメインスレッドに戻ることができます。
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//All your views cell creations and other stuff
[self performSelectorInBackground:@selector(loadDataThatToBeFetchedInThread:)
withObject:objectArrayThatNeedToFetchData];
}
- (void) loadDataThatToBeFetchedInThread:(NSArray *)objectThatNeedToFetchData
{
//Fetch the data here. which takes place in background thread
[self performSelectorOnMainThread:@selector(updateTableViewWithTheData:)
withObject:responseData
waitUntilDone:YES];
}
- (void) updateTableViewWithTheData:(NSMutableArray *)yourData
{
//Update Data to tableview here
}
申し訳ありません私は1つだけ+1を与えることができます:) –
^ありがとう、私は確かにそれを試してみましょう – Shantanu
すべてのUI機能は、メインスレッドで実行する必要があります。したがって、メインスレッドのみでUITableViewをリロードする必要があります。
素晴らしいコメントのように見えます!しかし、多分あなたはその質問を見ているかもしれません! –
- 1. iPhone VOIP in background
- 2. iphoneタイマーカウントダウンin background
- 3. Delphi:TWebBrowser in background-thread
- 4. GearmanManager in background
- 5. Timer in Background
- 6. Qt drawRect in background
- 7. Android:SQLiteCursor/SimpleCursorAdapter in background
- 8. UIWebView stringByEvaluatingJavaScriptFromString in background
- 9. Android:Timer in Background Service
- 10. Android Camera in Background
- 11. Rails + XMPP bot in background
- 12. SDWebImageDataSource in KTPhotoBrowser --iPhone
- 13. related to performSelector
- 14. iPhone - Textured Backgroundの作成方法
- 15. performselectorメソッド
- 16. ForループでperformSelectorを使用しますか? iPhone
- 17. HttpBasicAuthentication in IPhone
- 18. iFrames in iPhone
- 19. iPhone MKMapView in UITableViewCell
- 20. ScoreLoop in iPhone
- 21. iphone、UITableField in UITableView
- 22. GCM 501 in IPhone
- 23. カテゴリクラスメソッドのperformSelector
- 24. performSelectorは、デバッグモード
- 25. performSelector on C++クラスメソッド?
- 26. performSelector ARC警告
- 27. dispatch_after対performSelector afterDelay
- 28. IE9バグのcss background-repeat inインライン表示要素
- 29. PerformSelector遅延がバックグラウンドモードで実行されなかった後 - iPhone
- 30. iPhone - SDKで "Open In"?
バックグラウンドでのUI更新はありません。 UIの変更はメインスレッドで実行する必要があります。 – lukya