隐藏的 UITabBarController 覆盖 Button
我有一个隐藏的 UITabBarController 但它似乎掩盖了我想放置在主视图中屏幕底部边缘的按钮。
// hide the tabBar for the home screen
- (void) viewWillAppear:(BOOL)animated
{
self.tabBarController.tabBar.hidden = YES;
}
有办法解决这个问题吗?除主视图(即第一个选项卡)之外的其他视图都会显示选项卡栏。
干杯!
I have a hidden UITabBarController but it seems to cover up the buttons that I'd like to place at the bottom edge of the screen in the home view.
// hide the tabBar for the home screen
- (void) viewWillAppear:(BOOL)animated
{
self.tabBarController.tabBar.hidden = YES;
}
Is there a way around this? The tab bar will be shown for the other views except for the home view (i.e. the first tab).
Cheers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以做的是在 Interface Builder 中(假设您从 IB 中添加了 UITabBarController),从菜单中选择:
Layout -->当 TabBar 突出显示时发送到后面
。这意味着在“主页”视图上它不会遮挡按钮,而在其他视图上它会位于前面,假设您没有其他按钮位于其他视图中 UIView 中的相同位置。当然,当您离开主视图时加载新的视图控制器并在此时调用 UITabBar 会更干净,这样您就不必诉诸这种 UI 技巧。
即您的主视图和其他屏幕(带有 UITabBar)将位于两个不同的 XIB 中。
What you could do is in Interface Builder (assuming you added the UITabBarController from within IB) choose from the Menu:
Layout --> Send To Back
while the TabBar is highlighted. This would mean that on the "home" view it would would not obscure the buttons and on the other views it would be at the front, assuming you have no other buttons located at the same position in the UIView in your other views.It would, of course, be cleaner to Load a new view controller when you navigate away from the home view, and invoke the UITabBar at that point, so that you don't have to resort to this kind of UI trickery.
i.e. your home view and your other screens (with the UITabBar) would be in two different XIBs.