How does Xcode load the main storyboard?

后端 未结 7 1210
遥遥无期
遥遥无期 2020-12-13 08:37

When I create a new single view application in Xcode 4.6 using storyboard, we can see that the main function creates a new application using the application delegate like th

相关标签:
7条回答
  • 2020-12-13 09:03

    Look at your Target settings for the Project

    enter image description here

    Notice the Main Storyboard setting.

    If you wanted to do this in code yourself, you would do something like.

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    
       UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]];
       UIViewController *vc = [storyboard instantiateInitialViewController];
    
       // Set root view controller and make windows visible
       self.window.rootViewController = vc;
       [self.window makeKeyAndVisible];
    
       return YES;
    }
    
    0 讨论(0)
提交回复
热议问题