Reputation: 6324
I have a tab bar controller with 2 view controller. When the application is launched everything works and texts are being shown in the the tab bar but when I select the second view controller(settings) text disappear (image remain shown). any idea? thanks
the label "settings" disappeared.
Upvotes: 0
Views: 318
Reputation: 407
Make sure you're declaring them properly like this:
nav.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"Home" image:[UIImage imageNamed:@"a.png"] tag:0];
tabBarItem = [[UITabBarItem alloc]initWithTitle:@"Second" image:[UIImage imageNamed:@"b.png"] tag:1];
If you try declaring the title after initWIthImage you can lose the titles sometimes
I've done it for 5 tab items like above (shortened code obv) and they all work perfectly
EDIT: You added the the Nib file layout after i posted, I do everything programmatically
Upvotes: 2
Reputation: 44633
Reposting comment as answer on OP's request.
Are you implementing any of the UITabBarController methods? And are you implementing the settings view controller's viewDidLoad, viewWillAppear: and viewDidAppear: methods? Guess is that it is being reset in those methods.
Upvotes: 1
Reputation: 1637
Maybe you are adding the images and other elements to the AppDelegate's window instead of adding them to the view in "Settings view controller"? Please give some feedback so we can help you better.
Upvotes: 0