How to load a scene in a storyboard from a view controller

笑着哭i 提交于 2019-12-06 00:49:06

If your code is inside a view controller (which it seems to be), you can get the current storyboard with self.storyboard. You also don't need instantiateInitialViewController because, if all your UI is coming from the same storyboard, it has already gone through the loading of the initial controller.

As for the actual error, it's complaining that @"WritePostView" isn't a recognized name for any view controller in the storyboard. Note that what it looks for here is not the class name for the controller but the Storyboard ID for the controller. (Which makes sense since you could have different "scenes" with the same type of controllers.)

Ok, it seems is solved. I just have added a segue between scenes

and then I just need to add this one:

[self performSegueWithIdentifier:@"writePostViewSegue" sender:self];

and it works!. Anyway, I am not sure if it is the way to do it, so if someone knows better, please let me know.

Cheers

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