xcode 是否可以在没有导航控制器的情况下推送视图控制器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6290097/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is it possible to push a view controller without navigation controller?
提问by Cagatay VASFI
i've just started to write an application and i want to write it without navigation controller thereis going to be some viewController EX: aviewController , bviewController ...
我刚刚开始编写一个应用程序,我想在没有导航控制器的情况下编写它,那里将有一些 viewController EX: aviewController , bviewController ...
Is it possible to push to b class's view controller (bviewController) from aViewController wiyhout using navigation controller ?
是否可以使用导航控制器从 aViewController wiyhout 推送到 b 类的视图控制器(bviewController)?
With otherwords ,
换句话说,
are there any different option for this code :
这段代码有什么不同的选择:
[self.navigationController pushViewController:self.bViewController animated:YES];
???
[self.navigationController pushViewController:self.bViewController animated:YES];
???
回答by LuckyLuke
You could use a UINavigationController and push it, and hide the navigationbar.
您可以使用 UINavigationController 并推送它,然后隐藏导航栏。
回答by Schoob
Are you looking for this maybe?
你在找这个吗?
[self.bViewController.navigationController setNavigationBarHidden:YES animated:YES];
回答by rckoenes
You display a Modal view:
您显示一个模态视图:
[self presentModalViewController:someViewController animated:YES];
The transition animation is set on the viewcontroller that you are going to display.
过渡动画设置在您要显示的视图控制器上。
As @deanWombourne stated below, why don't you wan't to use the Navigation controller? If you are pushing viewcontrollers then the navigation controller is the way to go.
正如@deanWombourne 所述,您为什么不使用导航控制器?如果您正在推送视图控制器,那么导航控制器就是您要走的路。
If you don't want the navigationbar you can just hide it and pop the view controller your self:
如果你不想要导航栏,你可以隐藏它并自己弹出视图控制器:
// Remove the current visible view controller:
[self.navigationController popViewControllerAnimated:YES];