UIPageControl隐藏在UITabBar下

时间:2014-01-23 10:53:55

标签: ios ios7 uitabbar uipagecontrol

我正在使用UIPageViewControllerUIPageControl来表示现有的网页数。

但是,当我将整个viewcontroller放在UITabBarViewController中时,标签栏会隐藏UIPageControl

我的假设是UIPageControl是我的viewcontroller的子视图,因此当我将viewcontroller放在tabbar中时,整个页面应该根据需要缩小以放置tabbar。我没想到标签栏会隐藏屏幕的下半部分。

我在这里有一个small sample project 来证明这个问题。

我怀疑我必须限制可见帧,这是正确的吗?建议会很棒。

更新

我的假设是对的。我想出了这个并且它有效:

CGRect rect = CGRectMake([[self view] bounds].origin.x,
                             [[self view] bounds].origin.y,
                             [[self view] bounds].size.width,
                             [[self view] bounds].size.height-10);
                             [[self.pageController view] setBounds:rect];

如果有更好的方法可以做到这一点,很高兴知道。否则我把它作为答案。

1 个答案:

答案 0 :(得分:12)

我在使用故事板时遇到了同样的问题。

我通过删除显示我的pageViewController的视图控制器的“Under Bottom Bars”来检查问题。