UITableView via NSFetchedResultsControllerDelegate, select first record by default?
- by deafgreatdane
I have a UITableView that gets populated from CoreData via a controller that implements NSFetchedResultsControllerDelegate. How can I have it automatically select the first row (and fire the tableView:didSelectRowAtIndexPath message)?
The tableview is used for a variety of predicate queries, so I'm suspicious of solutions that work on the UIViewController lifecycle (viewDidLoad, etc), but I'm new to the platform, so I'm open.
I've tried a variety of things, but I'm not sure where in the call stack to put it. I've tried calling cell.selected = true inside tableView:cellForRowAtIndex: method, but that just ends up turning the cell black (and doesn't fire the selected callback method)
A tagent question, with all the delegating and core data protocols, does it imply asynchronous data fetch (multiple threads)? Or is the NSFetchedResultsController calling all its related methods in the same thread? Maybe I'm just scared that if it is async, there would be race conditions that would be tough to troubleshoot later.