Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITabbar item title/name disappear for the second tab

I have a tabbar controller in my iphone app. Everything was fine until the second tabbar item is clicked. When its clicked, the tabbaritem title/name under the tabbar icon for the second tab will disappeared. But there's no problem with the first tab.

Do anybody knows whats the reason for this.

like image 945
sicKo Avatar asked May 09 '11 03:05

sicKo


2 Answers

In my case, the title was being set correctly but the color of the title was in "clear color" when selected.

Solution:

In AppDelegate.m

[[UITabBarItem appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName : [UIColor blackColor] }
                                         forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName : [UIColor redColor] }
                                         forState:UIControlStateSelected];
like image 21
Taku Avatar answered Nov 30 '22 16:11

Taku


It may be the problem with the view controller in the second tab bar item. Have you used the title inside of the view controller of the second tab bar item. If no then try using title of the view controller to the name/title of the second tab bar item. I hope this should solve the issue.

like image 95
Sandeep Avatar answered Nov 30 '22 16:11

Sandeep