0

在我公司的新聞項目中,我需要提供搜索功能。使用CoreData在UITableViewController中搜索:第二個NSFetchedResultsController?

我正在使用UITableViewController和CoreData/NSFetchedResultsController來顯示新聞和一個UISearchDisplayController來提供搜索。

現在我的問題: 有什麼更好的辦法: - 使用相同的fetchedResultsController爲「正常」表和搜索結果表 - 使用第二fetchedResultsController的搜索結果表

感謝名單!

回答

0

是的 - 基本上最好有另一個NSFetchResultsController搜索表。

當您在表格和模式(搜索和正常瀏覽)之間切換時,性能會更好。

當你實現NSFetchedResultsController委託時 - 當數據更改時刷新表 - 如果不需要重新加載兩個表,NSFetchedResultsController允許你重新加載一個表。

+0

謝謝!這是你的個人意見還是你有一個蘋果文檔或什麼的鏈接? – mike

+0

這是我個人從我自己的項目中走出來的問題,以及我只使用過的一個問題。但你可以找到更多的解決方案 - http://raywenderlich.com/或http://stackoverflow.com/questions/44712​​89/how-to-filter-nsfetchedresultscontroller-coredata-with-uisearchdisplaycontroll?answertab=oldest#tab-最佳 –

相關問題