How to perform segue to a nib from storyboard

核能气质少年 提交于 2019-12-06 11:19:59

问题


I have 90% of my current project done in storyboard but I am also using a single xib view controller for an "enter your pin" view because this is the way it was integrated in a github project that I imported into my project. I need to segue from the xib back to storyboard. Going from storyboard to the xib was easy with a push method but now I would like to modal to another view in storyboard. Any suggestions? First, I tried to convert the xib to a view in storyboard but I failed as it was designed to work with nibs.


回答1:


You can create a new instance of any view controller on the storyboard by calling its instantiate method.

So do something like:

[storyboard instantiateViewControllerWithIdentifier:@"identifier"];



回答2:


First get the ViewController you need from your storyboard (therefor you need to set an identifier for the viewcontroller in the storyboard

ViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"identifier"];

Then segue to this controller

[self presentModalViewController:vc animated:YES]; 


来源:https://stackoverflow.com/questions/12076393/how-to-perform-segue-to-a-nib-from-storyboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!