I want to use UITabBar but without images. I want the text to occupy full control space. i tried setting image to nil, but text is small and aligned to bottom of tabbaritem.
This function changes the font of all UITabBarItems:
[[UITabBarItem appearance] setTitleTextAttributes: aNSDictionaryOfTextAttributes];
you can specify the font type and size with a dictionary of attributes similar to those found in this answer here. And then negatively offset the vertical position of the text with this:
[[UITabBarItem appearance] setTitlePositionAdjustment:UIOffsetMake(0.0, -18.0)];
Copy this to your didFinishLaunchingWithOptions
.
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:17.0], NSFontAttributeName, nil];
[[UITabBarItem appearance] setTitleTextAttributes:attributes forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitlePositionAdjustment:UIOffsetMake(0.0, -13.0)];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With