views:

56

answers:

1

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?

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
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