I have to increase the height of UITabbar. How can I do this any help please?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.
回答2:
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!
回答3:
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.
回答4:
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.