I have a multiview application using a tab bar to switch views. One is a pickerview while the other two are a table view and a view with 4 text fields (and one other table view that just contains instructions on how to use the app). I want to use core data to save selected rows in the picker view and also save strings that are entered in the text field view. The table view will obviously display all these saved results. So how do I link all these together? Do I create an abstract class just for the core data methods (including the fetchedResultsController) so each view controller can subclass and access the managedobjects and methods from said abstract class? Or is there a better way to do this?
views:
56answers:
1
A:
What I would do is implement a <UITabBarDelegate> class to act as the hub for data for the tabs, since they're all operating on the same data set. When a tab is selected, hand it the NSManagedObjects it needs for display (in the case of the history tab, that will be your main array of objects...). You'll minimize repetition and the need to hand around the key Core Data objects (NSManagedObjectContext, etc).
Seamus Campbell
2010-08-05 01:27:37
Ok, so that's sort of like the RootController if I was using the UINavController based Core Data template in Xcode, right? So I created a class called tabBarDelegate with the one method of -didSelectItem but can't figure out how to link it to my tabBarController. I think I fumbled my attempt in IB so is there a way to do it just in Xcode? I always get confused going back and forth with IB and Xcode (which is why I'm excited about Xcode 4)
Robot-Scott
2010-08-05 21:54:22