Instantiating a View Controller programmatically with Storyboard from AppDelegate

前端 未结 4 932
天命终不由人
天命终不由人 2020-12-30 07:58

I\'m busy building an app - that when launched for the first time it asks the user to do two things:

  1. Select a Country
  2. Accept T&Cs
<
4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-30 08:36

    There are two things you need to do:

    1. In Storyboard you have mentioned the controller name (eg LoginView) and enable use storyboard ID
    2. Then you have user the below line

      loginView = [storyboard instantiateViewControllerWithIdentifier:@"LoginView"];
      [(UINavigationController*)self.window.rootViewController pushViewController:loginView animated:NO];
      

    Hope this helps. Let me know if you're still having the issue.

提交回复
热议问题