xcode 如何关闭视图控制器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8650807/
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
How to CLOSE View Controller
提问by Trinh
Please help me. I have "View Controller(VC) 1" + button "End" and VC 2 I want to end "VC 1" and Switch to VC2 when I touch a button "End". I tried searching online but only "Switch view"... but SWITCHING isn't ENDING
请帮我。我有“视图控制器(VC)1”+按钮“结束”和VC 2,当我触摸“结束”按钮时,我想结束“VC 1”并切换到VC2。我尝试在线搜索但只有“切换视图”...但切换并未结束
回答by Alex Coplan
What do you mean by end a view controller?
结束视图控制器是什么意思?
If you want to pop it off a navigation controller, you can use
如果你想把它从导航控制器上弹出,你可以使用
[self.navigationController popViewController];
If you want to forcefully close your app (this will get it rejected) use
如果您想强行关闭您的应用程序(这将使其被拒绝)使用
exit(0);
EDIT:
编辑:
Now you have somewhat improved your question, I can tell you that thisquestion provides a good overview on switching views.
现在您的问题有所改进,我可以告诉您,这个问题很好地概述了切换视图。
The top answer uses code from a book called "Beginning iPhone Development" which I would highly recommend if you are just starting out with iPhone Programming.
最佳答案使用一本名为“ Beginning iPhone Development”的书中的代码,如果您刚开始使用 iPhone 编程,我强烈推荐它。