Is it possible to have UITabBarItem without image, but with bigger text instead?
e.g.: to have text with full height?
Is it possible to have UITabBarItem without image, but with bigger text instead?
e.g.: to have text with full height?
Sure, just make an image of the larger text. As far as I know, that's the only way.
Yes, you can initialise it with an empty image like this:
UIImage* image = [[UIImage alloc] init];
tabBarItem = [[UITabBarItem alloc] initWithTitle:title image:image tag:tag] ;
[image release];
Only the title text will be displayed.
Full solution is here.
You need to set empty image to tabBarItem. Otherwise tabBarItem will not appear until you tap it.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.tabBarItem.title = @"Report";
self.tabBarItem.image = [[UIImage alloc] init];
}
return self;
}
Customization of UITabBar:
- (void)customizeAppearance
{
[[UITabBar appearance] setBarTintColor:[UIColor blackColor]];
[[UITabBar appearance] setTranslucent:NO];
[[UITabBarItem appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName:[UIColor whiteColor],
NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue-Thin" size:22]}
forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName:RGB(0xff9700),
NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue-Thin" size:22]}
forState:UIControlStateSelected];
[[UITabBarItem appearance] setTitlePositionAdjustment:UIOffsetMake(0.0, -10.0)];
}