我正在实现基于 iAdSuite 中的 TabbedBanner 示例的设计。我在第一个选项卡中有一个 UINavigationController。在那个 UINavigationController 中,我有一个 View Controller ,它只有一个按钮可以推送到另一个 View Controller 。推送的 View Controller 在 Interface Builder 中设置为在推送时隐藏底部栏。
这是我设置 UITabBarController 的代码。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:[[NSBundle mainBundle].infoDictionary objectForKey:@"UIMainStoryboardFile"] bundle:[NSBundle mainBundle]];
_tabBarController = [storyboard instantiateViewControllerWithIdentifier:@"TabBarController"];
_tabBarController.delegate = self;
FirstViewController *firstView = [storyboard instantiateViewControllerWithIdentifier:@"FirstViewController"];
UINavigationController *firstNav = [[UINavigationController alloc] initWithRootViewController:firstView];
_tabBarController.viewControllers = @[[[BannerViewController alloc] initWithContentViewController:firstNav], ];
self.window.rootViewController = _tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
除了当我推送到下一个 View Controller 时 TabBar 没有隐藏外,一切正常。我尝试使用 Interface Builder 复选框以及使用 nextViewController.hidesBottomBarWhenPushed = YES 隐藏 TabBar,但两种方法都不起作用。
如果我删除 BannerViewController 实现,TabBar 会完全隐藏。 在我看来,BannerViewController 正在干扰 UINavigationController 能够隐藏 TabBar。
是否可以在这种类型的设置中使用“按下时隐藏底部栏”来隐藏 TabBar?
谢谢
注意:我意识到上面的代码只有一个选项卡。为了清楚起见,我删除了其他选项卡。
最佳答案
我认为这是因为 BannerViewController 本身只是一个容器 viewController,它实际上从未推送另一个 View Controller 。 View Controller 被推送到容器中。
关于ios - BannerViewController 干扰 hidesBottomBarWhenPushed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16199335/