Push View Controller not showing elements added from storyboard

后端 未结 2 1817
北荒
北荒 2021-01-23 03:56

Okay, so far I\'ve two view controllers in my storyboard. One with \"login\" elements and other as \"User\'s home\" sort of thing. I am intending to do the following : When user

相关标签:
2条回答
  • 2021-01-23 04:44

    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:

    enter image description here

    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.

    0 讨论(0)
  • 2021-01-23 04:52

    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):

    Segue between 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.

    0 讨论(0)
提交回复
热议问题