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<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];


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM