Push View Controller not showing elements added from storyboard

牧云@^-^@ 提交于 2019-12-02 01:33:00

Using storyboards you should be using:

UIViewController *homeView = [self.storyboard instantiateViewControllerWithIdentifier:@"someID"];
[self presentViewController:homeView animated:YES completion:NULL] ;

Then set the ID to the view controller in storyboard like so:

Additionally, if you wish to there is absolutely nothing wrong with designing your UI entirely in code. Personally I prefer it. It gives you much more flexibility than interface builder.

In addition to NSPostWhenIdle's suggestion of instantiateViewControllerWithIdentifier, you can also define a segue between the two view controllers (not between the button and the second controller, but between the two view controllers):

Then give the segue a unique identifier, and then have your IBAction method do a performSegueWithIdentifier. This way your storyboard will continue to visually represent the various relationships between your view controllers.

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