Xcode13纯代码

新建项目之后

1.删除info.plist的Storyboard Name:Main Main Storyboard file base name :Main
2.删除Main.StoryBoard
3.清空General里的Main(target的General的Deployment info 的Main Interface )
4在sceneDelegate找到这个方法,里面插入如下代码,具体情况依照开发而定.

- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {

    UIWindowScene *wscene = (UIWindowScene *)scene;
    DemoViewController *rootVC = [DemoViewController new];
    UIWindow *window = [[UIWindow alloc] initWithWindowScene:wscene];
    window.rootViewController = rootVC;
    self.window = window;
    [self.window makeKeyAndVisible];
}

5.在AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  if ([[[UIDevice currentDevice] systemVersion]floatValue]<13) {
      DemoViewController *rootVC = [DemoViewController new];
      self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
      self.window.rootViewController = rootVC;
      [self.window makeKeyAndVisible];
  }
  return YES;
}


你可能感兴趣的:(Xcode13纯代码)