【发布时间】:2014-05-27 11:25:20
【问题描述】:
我使用UITabBarController 作为根视图,并且应用支持 iOS 6 及更高版本。项目类层次结构如下。
UITabBarController
- tab1
- UINavigationController
- UIViewController
- UIViewController
.
.
- tab2
- UINavigationController
- UIViewController
- UIViewController
.
.
.
- tab3
- UIViewController
- tab4
- UIViewController
我使用下面的代码在上面的层次结构中的一个 UIViewControllers(在 UINavigationController 内)中更改 UITabBar 的高度。
CGRect tabbarFrame = self.tabBarController.tabBar.frame;
tabbarFrame.size.height += 60;
self.tabBarController.tabBar.frame = tabbarFrame;
但它没有改变高度。 UITabBar 以默认高度显示。尽管记录其值会打印更改的值,如下所示。
<UITabBar: 0xb528f60; frame = (0 431; 320 109); autoresize = W+TM; layer = <CALayer: 0xb529080>>
我怎样才能改变UITabBar 的高度来达到这样的效果:?
【问题讨论】:
-
你可以改变默认的tabbar高度,但是你需要继承UITabBarController,我之前做过,我写在stackoverflow.com/questions/16740824/tab-bar-with-large-icons/…
-
发现这行得通 -> stackoverflow.com/a/27494228/1484378
-
我想你也可以只设置一个高度限制,它似乎对我有用。
标签: ios objective-c uitabbarcontroller height uitabbar