Xcode11后的SceneDelegate,创建控制器

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

}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。