0
votes

I'm working on an application that utilizes a UITabBarController that is currently embedded in a UINavigationController (w/ 3 children view controllers).

I want each of these child vc's to display different things on their navigation bars (different titleviews, buttons, etc), similarly to yik yak's interface (those vc's are in a tab bar controller as well):

enter image description here

Right now, the navigation bar isn't functioning correctly between switching tabs, instead each time i switch between tabs, that presented view controllers nav bar settings override the previous one (if it hasn't been set yet). If it has, it just displays the current nav bar settings.

Abstractly, my app structure is like this:

UINavigationController -> UITabBarController -> UIViewController #1
                                             -> UIViewController #2
                                             -> UIViewController #3

I am setting each view controller's nav bar settings in viewDidLoad

Example:

- (void)viewDidLoad {    
self.tabBarController.navigationItem.titleView = _segmentedControl;
self.tabBarController.navigationItem.titleView.tintColor = FlatBlue;
}

What should I change to get this desired effect? Set the navigation bar settings in a different place? Embed each child vc in another uinavigationcontroller?

Would love some help, couldn't find any sources to this anywhere!

Thanks

1
set them in ViewWillAppear. You technically don't have a navbar yet in viewDidLoadChase

1 Answers

0
votes

As mentioned in the comments, the solution was to switch the nav bar setup and logic from:

viewDidLoad

to

viewWillAppear