TAB BAR CONTROLLER
I have a tab bar controller with 2 view controller. When the applicati开发者_如何学Goon 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.
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
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.
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.
精彩评论