I have an app with a custom UITabBarController that contains five view controllers. Within each of these view controllers, other view controllers can be accessed. Ideally, I would like my custom UITabBarController to appear in each ViewController-regardless on whether or not the view controller originates directly from the tabbar.
I think this can be accomplished using a Navigation Controller within each of the original five view controllers, however, is there a way to just add the custom UITabBarController to each view controller? I tried doing this by the following ways in my viewDidLoad methods:
AppDelegate *appDelegate = [(AppDelegate *)[UIApplication sharedApplication] delegate];
tabbarController = appDelegate.tabBarController;
tabbarController.view.frame = CGRectMake(0, 0, 320, 480);
[self.view addSubview:tabbarController.view];
but I get a bad_access in my app delegate when I run the code.
Any thoughts?
As you correctly stated, using ‘UINavigationController’s as root controllers of each tab will achieve what you are trying to do.
Here is an example of how to easily setup your tabbar with navigation controllers:
Hope this helps 🙂