我可以使用以下代码在ViewController推送(加载)时隐藏tabBar:- (BOOL)hidesBottomBarWhenPushed
{
return YES;
}
但是,当应用程序在后台运行并且applicationDidBecomeActive时,tabBar会重新出现。我努力了
self.tabBarController.tabBar.hidden = YES;
但这没用。
我可以通过更新tabBar的框架来隐藏它
if([view isKindOfClass:[UITabBar class]])
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y + view.frame.size.height, view.frame.size.width, view.frame.size.height)];
}
这是执行此任务的最佳方法,并且被Apple App Store接受吗?
最佳答案
您无需使用任何方法来在选项卡栏上四处摸索(没有任何好的和有用的方法,并且出于某种原因设置其隐藏属性不会有任何影响。)您可以将其移出屏幕。了解对标签栏的引用,并以某种方式设置其框架,使其origin.x
大于屏幕(或self.view
的)size.width
和/或对origin.y
和size.height
进行相同操作。
关于ios - 当应用程序变为事件状态时,iOS TabbarViewController隐藏选项卡栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35061861/