
[英]IOS 8 Storyboards using SplitViewController with iPhone gets Unbalanced calls to begin/end appearance transitions for <MasterViewController>
[英]UISplitViewControllerDisplayModePrimaryOverlay causes “Unbalanced calls to begin/end appearance transitions”
在iOS 8中,将UISplitViewController上的preferredDisplayMode设置为PrimaryOverlay会生成以下警告:
“UINavigationController的开始/结束外观转换的不平衡调用”
如果我将preferredDisplayMode设置为AllVisible或根本不设置它,则没有问题。 我尝试过的模拟器中的所有iPad和iPhone都出现问题。 无论应用程序是纵向还是横向启动,都会出现问题。
这是一些非常简单的代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; UITableViewController *tableViewController = [[UITableViewController alloc] init]; UIViewController *viewController = [[UIViewController alloc] init]; UINavigationController *masterNavController = [[UINavigationController alloc] initWithRootViewController:tableViewController]; UINavigationController *detailNavController = [[UINavigationController alloc] initWithRootViewController:viewController]; UISplitViewController *svc = [[UISplitViewController alloc] init]; [svc addChildViewController:masterNavController]; [svc addChildViewController:detailNavController]; //svc.preferredDisplayMode = UISplitViewControllerDisplayModeAllVisible; svc.preferredDisplayMode = UISplitViewControllerDisplayModePrimaryOverlay; self.window.rootViewController = svc; [self.window makeKeyAndVisible]; return YES; }
将您的显示代码包装在dispatch_async
。 否则iOS似乎与同时运行的其他动画混淆。
dispatch_async(dispatch_get_main_queue(), ^{
svc.preferredDisplayMode = UISplitViewControllerDisplayModePrimaryOverlay;
});
要么
dispatch_async(dispatch_get_main_queue()) {
svc.preferredDisplayMode = .PrimaryOverlay
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.