2020년 10월 16일 금요일

After removing storyboard, app appears black in iOS with Objective-c.

1. set iOS version over 13 and make "Main Interface" is empty

2. add a ViewController

3. nd code below in the SceneDelegate.m 

- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {

    // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.

    // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.

    // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).

    

    self.window = [[UIWindow alloc] initWithWindowScene:(UIWindowScene*)scene];

    MainViewController *controller = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];

    self.window.backgroundColor = [UIColor redColor];

    self.window.rootViewController = controller;

    [self.window makeKeyAndVisible];

}

댓글 없음:

댓글 쓰기