presentViewController in AppDelegate with delay in iOS8

前端 未结 5 749
长发绾君心
长发绾君心 2021-02-02 10:02

So I had a full working solution in iOS7 that displays a LoginViewController via presentViewController in the AppDelegate\'s didFinishLaunching.

Basically I am doing so

5条回答
  •  难免孤独
    2021-02-02 10:36

    Also a hack (for now), but just one line of code

    Add the view of the view controller you're presenting to the window before presentation

    UIViewController *viewController = [[UIViewController alloc] init];
    [viewController.view setBackgroundColor:[UIColor greenColor]];
    
    //  Temporary iOS8 fix for 'presentation lag' on launch
    [self.window addSubview:viewController.view];
    
    [self.window.rootViewController presentViewController:viewController animated:NO completion:nil];
    

    If you are presenting a navigation controller than add the navigation controller's view instead of its top view controller.

提交回复
热议问题