[英]Increase size of UITabbar
I need to subclass a UITabBar
and increase its size. 我需要子类化一个
UITabBar
并增加其大小。
I made it with code 我用代码做到了
-(CGSize)sizeThatFits:(CGSize)size
{
CGSize sizeThatFits = [super sizeThatFits:size];
sizeThatFits.height = kTabBarHeight;
return sizeThatFits;
But this stretches it. 但这会延展它。 How can I increase it without stretching?
如何在不拉伸的情况下增加它? I need some clear area.
我需要一些空白区域。
I faced this issue and I was able to solve it. 我遇到了这个问题,并且能够解决它。 You have to add following code to your subclass of UITabBarController class.
您必须将以下代码添加到UITabBarController类的子类中。
- (void)viewWillLayoutSubviews
{
CGRect tabFrame = self.tabBar.frame; //self.TabBar is IBOutlet of your TabBar
tabFrame.size.height = 80;
tabFrame.origin.y = self.view.frame.size.height - 80;
self.tabBar.frame = tabFrame;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.