starting ios project without storyboard

前端 未结 9 1232
渐次进展
渐次进展 2021-01-12 23:28

Im having some troubles to start an iOS app using xibs instead of storyboard. The problem is that im getting a black screen and the first view controller is not being called

9条回答
  •  -上瘾入骨i
    2021-01-13 00:05

    In xCode 11:

    Step1:

    -> Delete the storyBoard file

    Step2:

    Under yourProject > General > deployment info > main interface -> delete reference to storyboard

    Step 3:

    In info.plist > Application Scene Manifest > Scene Configuration > Application Session Role > item 0 > storyboard name

    -> Delete the line

    Step 4:

    In SceneDelegate.m

     - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
    
              self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
              self.window.windowScene = (UIWindowScene *)scene;
              self.window.rootViewController = [[UINavigationController alloc] 
                                   initWithRootViewController:ViewController.new];
              [self.window makeKeyAndVisible];
    
    }  
    

    make sure to import your viewController headfile like so: #import "ViewController.h"

提交回复
热议问题