iOS13中appdelegate的职责发现了改变:
    iOS13之前,Appdelegate的职责全权处理App生命周期和UI生命周期;
    iOS13之后,Appdelegate的职责是:
    1、处理 App 生命周期
    2、新的 Scene Session 生命周期
    那UI的生命周期交给新增的Scene Delegate处理

    1. - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
    2. // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
    3. // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
    4. // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
    5. UIWindowScene *windowScene = (UIWindowScene *)scene;
    6. self.window = [[UIWindow alloc] initWithWindowScene:windowScene];
    7. self.window.frame = windowScene.coordinateSpace.bounds;
    8. UITabBarController *tabbarController = [[UITabBarController alloc] init];
    9. UIViewController *controller1 = [[UIViewController alloc] init];
    10. controller1.view.backgroundColor = [UIColor redColor];
    11. controller1.tabBarItem.title = @"新闻";
    12. UIViewController *controller2 = [[UIViewController alloc] init];
    13. controller2.view.backgroundColor = [UIColor yellowColor];
    14. controller2.tabBarItem.title = @"视频";
    15. UIViewController *controller3 = [[UIViewController alloc] init];
    16. controller3.view.backgroundColor = [UIColor blueColor];
    17. controller3.tabBarItem.title = @"推荐";
    18. UIViewController *controller4 = [[UIViewController alloc] init];
    19. controller4.view.backgroundColor = [UIColor greenColor];
    20. controller4.tabBarItem.title = @"我的";
    21. // 将四个页面的 UIViewController 加入到 UITabBarController 之中
    22. [tabbarController setViewControllers: @[controller1, controller2, controller3, controller4]];
    23. self.window.rootViewController = tabbarController;
    24. [self.window makeKeyAndVisible];
    25. }