How to use UITabBar without images... means with text only
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.开发者_如何学Python
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)];
While I'm not sure you can use a UITabBar that way, an alternative would be to use a UIToolbar and have "Custom" UIBarButtonItems with the style set to "Plain". That would give you a bar without images and have the text occupy the full control space.
Even I googled alot for the same, still I am not able to do that
It's the default,that text comes @ bottom in Tabbar...
But there is an alternative,as you need to create the whole tabitem to be as text
just use the image with the Text written on it.
It's Done !!!
Hope this might help me
精彩评论