我是 iOS 编程新手。我真的需要你的帮助。
我有一个登录屏幕,可以将我带到 map (google API)。单击任何创建的注释时,我想加载一个带有 2 个 View 的标签栏。
我搜索并发现我需要在开始时添加标签栏,即 appdelegate 并在需要时显示/隐藏标签栏。
所以我做了两个函数来显示和隐藏标签栏
-(void)Load_tabBar{
[self.navigationController.view removeFromSuperview];
[self.window addSubview:tabBarController.view];
[self.window makeKeyWindow];}
-(void)remove_tabBar{
self.tabBarController.selectedIndex=0;
[self.tabBarController.view removeFromSuperview];
[self.window addSubview:navigationController.view];
[self.window makeKeyWindow];}
当我调用 Load_tabBar 方法时它确实有效,当我单击返回时它调用 remove_tabBar 方法。如果我再次调用 Load_tabBar 方法并返回,它会崩溃并给出错误
-[UILayoutContainerView window]: 发送到释放实例0x563b0b0的消息
已编辑:PS:我可以将标签栏 View 添加到 View Controller ,然后推送该 View 吗?
谢谢
最佳答案
使用这个 self.hidesBottomBarWhenPushed = YES;
关于ios - 在需要时从 View Controller 显示/隐藏标签栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9159380/