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;
}


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容