iOS Xcode11 新建项目删除 ViewController,Storyboard,SceneDelegate

一. 删除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 *)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];

你可能感兴趣的:(iOS Xcode11 新建项目删除 ViewController,Storyboard,SceneDelegate)