移除main.storyboard

2023-12-12  本文已影响0人  醉了俗身醒了初心

解决方法如下:

image.png image.png image.png
@property(nonatomic, strong) UIWindow *window;
image.png
- (void) createAppWindow {
    if(@available(iOS 13.0, *)) {
        
    } else {
        self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
        self.window.rootViewController = [[ViewController alloc] init];
        self.window.backgroundColor = [UIColor whiteColor];
        [self.window makeKeyAndVisible];
    }
}
image.png
if(scene) {
        UIWindowScene *windowScene = (UIWindowScene*)scene;
        self.window = [[UIWindow alloc] initWithWindowScene:windowScene];
        self.window.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
        self.window.rootViewController = [[ViewController alloc] init];
        self.window.backgroundColor = [UIColor whiteColor];
        [self.window makeKeyAndVisible];
    }
上一篇下一篇

猜你喜欢

热点阅读