Mat
Mat

Reputation: 6324

TAB BAR CONTROLLER

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

enter image description here

enter image description here

the label "settings" disappeared.

enter image description here

Upvotes: 0

Views: 318

Answers (3)

Elmo
Elmo

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

Deepak Danduprolu
Deepak Danduprolu

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

Ruben Marin
Ruben Marin

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

Related Questions