美文网首页
Xcode13纯代码

Xcode13纯代码

作者: 学无止境吧 | 来源:发表于2021-10-25 10:47 被阅读0次

新建项目之后

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纯代码

      本文链接:https://www.haomeiwen.com/subject/ahujaltx.html