Xcode11后的SceneDelegate,创建控制器

2020-08-31  本文已影响0人  凤起梧桐

在SceneDelegate中:

- (void)scene:(UIScene*)scenewillConnectToSession:(UISceneSession*)sessionoptions:(UISceneConnectionOptions*)connectionOptions {

    UIWindowScene*windowScene = (UIWindowScene*)scene;

      self.window = [[UIWindow alloc] initWithWindowScene:windowScene];

      self.window.frame = windowScene.coordinateSpace.bounds;

      self.window.rootViewController = [ViewController new];

      [self.window makeKeyAndVisible];

    // 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).

}

上一篇 下一篇

猜你喜欢

热点阅读