AppDelegate中的presentViewController在iOS8中有延迟 [英] presentViewController in AppDelegate with delay in iOS8
问题描述
所以我在iOS7中有一个完整的工作解决方案,通过appDelegate的didFinishLaunching中的presentViewController显示一个LoginViewController。
So I had a full working solution in iOS7 that displays a LoginViewController via presentViewController in the AppDelegate's didFinishLaunching.
基本上我做的是这样的事情:
Basically I am doing something like this:
UIViewController *backgroundViewController = ...
self.window.rootViewController = backgroundViewController;
[self.window makeKeyAndVisible];
[self.window.rootViewController presentViewController:loginViewController
animated:NO ...]
在iOS8中,我看到了一个跳跃。首先,我看到backgroundViewController然后大约1秒钟左右登录出现。
In iOS8 I see a jump. First I see the backgroundViewController then after about 1 second or so the login appears.
那么,我如何防止iOS8中的这种跳跃?
So, how can I prevent this jump in iOS8?
我看到开发人员的https://devforums.apple.com/message/1014384#1014384>一吨 使用此某种问题但仍未找到解决方案。
I am seeing that are a ton of developers with this kind of problem but still didn't find a solution.
推荐答案
也是一个黑客(现在),但只有一行代码
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.
这篇关于AppDelegate中的presentViewController在iOS8中有延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!