Ali
Ali

Reputation: 11560

How to increase the size of UITabbar


I have to increase the height of UITabbar. How can I do this any help please?

Upvotes: 2

Views: 8202

Answers (4)

Hilen
Hilen

Reputation: 851

You can write a category of UItabbar

here is the code :

.h file :

#import 

@interface UITabBar (NewSize)
- (CGSize)sizeThatFits:(CGSize)size;
@end

.m file :

#import "UITabBar+NewSize.h"

@implementation UITabBar (NewSize)
- (CGSize)sizeThatFits:(CGSize)size {
    CGSize newSize = CGSizeMake(size.width,44);
    return newSize;
}
@end

and then #import "UITabBar+NewSize.h"

self.tabBarController = [[UITabBarController alloc] init];
[self.tabBarController.tabBar sizeThatFits:CGSizeMake(320, 44)];
self.tabBarController.tabBar.shadowImage = [[UIImage alloc]init];  //delete the default tabbar shadow!

Upvotes: 2

Ishu
Ishu

Reputation: 12787

You change its height, width, x and y coordinates. See this:

CGRect viewFrame=self.tabBar.frame;
        //change these parameters according to you.
        viewFrame.origin.y -=50;
   viewFrame.origin.x -=20;
   viewFrame.size.height=200;
   viewFrame.size.width=300;
        self.tabBar.frame=viewFrame;

You can change these parameters for tabBar not tabBar controller in case of tabBased app selected in starting when you select the app type.

Upvotes: 14

Jensen2k
Jensen2k

Reputation: 8408

This goes against the iOS Design Guidelines, but if you have to do it, you may subclass your tabbar-controller and alter it. It will not look good just changing the height.

Upvotes: 0

Robin
Robin

Reputation: 10011

I have seen posts of many people about the same similar thing. The only solution they came up with is sub classing the UITabbar. May be you can do that.

Upvotes: 0

Related Questions