每次创建新的工程或者写一个Demo,会新增scenedelegate.h和.m文件。但是我想回到之前的项目环境,由此引入……
1. 设置Deployment
在General中找到如下属性,删除Main Interface中Main
2. 设置info.list
找到如下属性,删除
3. 设置AppDelegate.m
删除或者注释如下两个方法:
- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options
- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions
4. 新增UIWindow
在AppDelegate.h
新增
@property (nonatomic, strong) UIWindow window;
在AppDelegate.m
中如下设置:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
XXXController *homeVC = [XXXController new]; //要展示的第一个viewController
UINavigationController *rootNavigation = [[UINavigationController alloc] initWithRootViewController:homeVC];
self.window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
self.window.rootViewController = rootNavigation;
[self.window makeKeyAndVisible]; // 设置Windows可见
return YES;
}