xcode 4.2 故事板,按代码继续
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9042801/
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
xcode 4.2 storyboard, segue by code
提问by Mona
I'm trying to make the segue between a button created by coding and a view created in storyboard?
我正在尝试在通过编码创建的按钮和在故事板中创建的视图之间进行切换?
(the button is not in the storyboard, it's made inside the viewcontroller .m class)
(按钮不在情节提要中,它是在 viewcontroller .m 类中制作的)
please help if you know the solution thanks,
如果您知道解决方案,请帮助,谢谢,
回答by rob mayoff
If the current view controller (the one that owns the button) came from the storyboard, you can just use the performSegueWithIdentifier:sender:
method of UIViewController
, like this:
如果当前视图控制器(拥有按钮的控制器)来自故事板,则可以使用 的performSegueWithIdentifier:sender:
方法UIViewController
,如下所示:
[self performSegueWithIdentifier:@"mySegue" sender:sender];