Iphone 如何从UIViewController中删除UIAbbarController
当我们使用Iphone 如何从UIViewController中删除UIAbbarController,iphone,ios,uiviewcontroller,uinavigationcontroller,uitabbarcontroller,Iphone,Ios,Uiviewcontroller,Uinavigationcontroller,Uitabbarcontroller,当我们使用UINavigationController从一个UIViewController移动到另一个UIViewController时,如何从UIViewController中删除uitabarcontroller 覆盖代码中的init函数(loadView可能无法工作) //或者,您可以通过将这些行放在名为urself的方法中,将其从app delegate中删除 [mainMenuTabBarController.view从SuperView移除] 您应该将UIViewControlle
UINavigationController
从一个UIViewController
移动到另一个UIViewController
时,如何从UIViewController
中删除uitabarcontroller
覆盖代码中的init函数(loadView可能无法工作)
//或者,您可以通过将这些行放在名为urself的方法中,将其从app delegate中删除
[mainMenuTabBarController.view从SuperView移除] 您应该将UIViewController设置为YES:BOOL hidesbottombarwhenpush
[self.tabBarcontroller.view removeFromSuperview];
例如:
下面代码的第二行是您要问的
UIViewController *destinationVC = [[UIViewController alloc] init];
[destinationVC setHidesBottomBarWhenPushed:YES]; // !!!
[self.navigationController pushViewController:destinationVC animated:YES];
这里创建ViewController的一个实例,然后在推送它之前,只需使用setHidesBottomBarPushed(),以便在推送它时隐藏它
但请记住,只有在推之前这样做,它才会起作用。请在提问时更详细。你的意思是隐藏tabbar吗?
UIViewController *destinationVC = [[UIViewController alloc] init];
[destinationVC setHidesBottomBarWhenPushed:YES]; // !!!
[self.navigationController pushViewController:destinationVC animated:YES];
[self.tabBarcontroller.view removeFromSuperview];
[self.tabBarcontroller.tabbar removeFromSuperview];
UIViewController *yourController = [[UIViewController alloc] init];
[yourController setHidesBottomBarWhenPushed:YES];
[self.navigationController pushViewController:yourController animated:YES];