一. 刪除ViewController,Storyboard
1:直接刪除Storyboard 和ViewController,不是刪索引,是直接移除;
2:info中的plist文件刪除 Main storyboard file base name
選項;
3:在appdelegaet
中重新創建window
,然后將自己的視圖設為根視圖然后讓gaiwindow
現實出來即可。
二. 刪除 SceneDelegate
1: 到info.plist
刪除Application Scene Manifest
選項;
2: 刪掉Scenedelegate.h和Scenedelegate.m這兩個文件;
3: 刪掉
- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions {}
- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {}
4: 在APPdelegate.h里面添加window屬性
@property (strong, nonatomic) UIWindow * window;
5:在-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
里面添加
self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];
// ViewController 是你的 rootViewController
self.window.rootViewController = [[ViewController alloc]init];
[self.window makeKeyAndVisible];