0

in a news project for my company I need to provide a search function.

I'm using a UITableViewController and CoreData/NSFetchedResultsController to show the news and a UISearchDisplayController to provide the search.

Now my question: What is the better way: - to use the same fetchedResultsController for the "normal" Table AND the search results table - to use a second fetchedResultsController for the search results table

Thanx!

mike
  • 15
  • 3

1 Answers1

0

Yes - basically it's best to have another NSFetchResultsController for search table.

It is better for performance when you switch between tables and modes (search and normal browsing).

Also you will get benefits from this approach when you implement NSFetchedResultsController delegate - to refresh tables when data changes - having 2 NSFetchedResultsController allows you to reload only one table if not needed to reload both.

Grzegorz Krukowski
  • 18,081
  • 5
  • 50
  • 71
  • thanks! Is that your personal opinion or do you have a link to an apple doc or something? – mike Mar 28 '14 at 09:29
  • It's my personal coming out of my own projects I worked on and problems I had using one only. But you can find more solutions like that - http://raywenderlich.com/ or http://stackoverflow.com/questions/4471289/how-to-filter-nsfetchedresultscontroller-coredata-with-uisearchdisplaycontroll?answertab=oldest#tab-top – Grzegorz Krukowski Mar 28 '14 at 09:47