I have created a navigation based project with coredata and replaced the navigationcontroller with a tabbarcontroller.
But im finding it hard to rewrite this:
UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController;
MasterViewController *controller = (MasterViewController *)navigationController.topViewController;
controller.managedObjectContext = self.managedObjectContext;
Thanks.
UITabBarControllerdoesn’t have a root view controller because it doesn’t manage a stack of view controllers, but rather the array (with view controllers ordered according to the slots occupied in the tab bar).This snippet of code will set managed object context for the first (leftmost) view controller in tab bar controller: