誰でも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. UIWebView stringByEvaluatingJavaScriptFromString in background
- 4. GearmanManager in background
- 5. MPMusicPlayerControllerPlaybackStateDidChangeNotification in background
- 6. Cordova AutoStart in Background
- 7. Timer in Background
- 8. iOS CoreLocation in background
- 9. Delphi:TWebBrowser in background-thread
- 10. Android:SQLiteCursor/SimpleCursorAdapter in background
- 11. Android Camera in Background
- 12. Qt drawRect in background
- 13. Android:Timer in Background Service
- 14. NSTimer with drawbarChart in Background
- 15. Rails + XMPP bot in background
- 16. do not background split in working
- 17. youtube video play in background htmlファイル
- 18. SDWebImageDataSource in KTPhotoBrowser --iPhone
- 19. related to performSelector
- 20. ForループでperformSelectorを使用しますか? iPhone
- 21. performselectorメソッド
- 22. iPhone - Textured Backgroundの作成方法
- 23. PerformSelector遅延がバックグラウンドモードで実行されなかった後 - iPhone
- 24. performSelectorは、デバッグモード
- 25. performSelector on C++クラスメソッド?
- 26. カテゴリクラスメソッドのperformSelector
- 27. dispatch_after対performSelector afterDelay
- 28. performSelector ARC警告
- 29. .bundle in iPhoneアプリケーション
- 30. iphone、UITableField in UITableView
バックグラウンドでのUI更新はありません。 UIの変更はメインスレッドで実行する必要があります。 – lukya