使用情节提要在 XCode 条件之后更改视图
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11569407/
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
Using storyboard to change view after condition in XCode
提问by Boban
I am developing iPhone app. I would like to use storyboard for views switching, but I have condition and I would like to do changing after condition is satisfied. How can I do that using storyboard?
我正在开发 iPhone 应用程序。我想使用故事板进行视图切换,但我有条件,我想在条件满足后进行更改。我怎样才能使用故事板做到这一点?
Thanks in advance..
提前致谢..
回答by Richard J. Ross III
Using segues.
使用转场。
First, you set up a segue like this, inside storyboard:
首先,在情节提要中设置这样的转场:
Then, you edit the identifier of the segue to something, in this case, NextView
:
然后,您将 segue 的标识符编辑为某些内容,在本例中为NextView
:
Then, finally, in your ViewController, when you want to switch views, call this code:
然后,最后,在您的 ViewController 中,当您想切换视图时,调用以下代码:
[self performSegueWithIdentifier:@"NextView" sender:self];