Xcode11后新建工程如何不使用SceneDelegate

657人浏览 / 0人评论 / 添加收藏

Xcode 11版本后创建工程时,会默认添加了SceneDelegate类,主要为了适配iOS13系统后的暗黑模式,可以通过一下方法退会到原版本。

  1. 删除SceneDelegate.hSceneDelegate.m文件
  2. 打开info.plist文件,删除 Application Scene Manifest 属性
  3. Appdelegate.h中添加 @property (nonatomic, strong) UIWindow *window;
  4. 删除AppDelegate.m文件中 UISceneSession 相关代码
  5. 初始化window
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
self.window.backgroundColor = [UIColor whiteColor];
self.window.rootViewController = [ViewController new];
[self.window makeKeyAndVisible];


备注:第5步可省略。

全部评论