How to increase the size of UITabbar
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.
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!
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.
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.
精彩评论