Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios tabbar put text in the middle when no image

My tabbar consists only of text, no images.
The problem is that the text always show on the bottom of the tab, is there a way to position the text in the middle ?

Thank you

like image 988
Dany Y Avatar asked Sep 25 '12 15:09

Dany Y


2 Answers

Got it!

[tab.tabBarItem setTitlePositionAdjustment:UIOffsetMake(0, -10)]

like image 82
Dany Y Avatar answered Nov 02 '22 23:11

Dany Y


A supplement, if you set multi viewControllers in tabBarController, you should use the following:

for (UITabBarItem* item in tabBarController.tabBar.items)
{
    [item setTitlePositionAdjustment:UIOffsetMake(0, -10)];
}
like image 37
vincentzhou vin Avatar answered Nov 02 '22 23:11

vincentzhou vin