UISplitViewController 和 UINavigationController 无法与多个故事板一起正常工作 [英] UISplitViewController and UINavigationController doesn't work properly with multiple storyboards

查看:40
本文介绍了UISplitViewController 和 UINavigationController 无法与多个故事板一起正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试(用于实验)使用多个故事板.第一个故事板(在启动时开始)只包含一个视图控制器,它执行一些代码并从网站下载 json 数据.

当完成下载任务时,视图控制器(第一个故事板的)在实例化第二个故事板后将第二个故事板的入口点设置为根视图控制器.

UIStoryboard *mainSB = [UIStoryboard storyboardWithName:@"SecondStoryboard" bundle:[NSBundle mainBundle]];UITabBarController *rootTabBarController = (UITabBarController *)[mainSB instantiateInitialViewController];dispatch_sync(dispatch_get_main_queue(),^{...self.view.window.rootViewController = rootTabBarController;

这个第二个故事板包含一个标签栏控制器,里面有一个拆分视图控制器:

一切正常,但在 splitview 控制器内部有一个奇怪的导航栏控制器行为.它的后退按钮在按下时可以工作,但无法正常显示,因为只有后退"文本而没有向左箭头.

]

(如果我只使用启动时的第二个故事板,一切正常)

我知道在这种情况下我只能使用一个故事板,但我想知道以这种方式处理多个故事板是否不正确,或者是否存在错误.

解决方案

新的 Xcode 7 Beta 和 iOS 9 都完美运行.

使用相同的文件配置,导航控制器的 V 形显示正确.不知道为什么,苹果在这个 WWDC 中发布了故事板参考,但我认为这是 UISplitViewController 的一个错误.

I'm trying (for experiment) to work with multiple storyboards. The first storyboard (starts at startup) contains only one view controller that executes some code and download json data from a website.

When finish the download task, the view controller (of first storyboard) set the entry Point of Second storyboard as root view controller after instantiating it.

UIStoryboard *mainSB = [UIStoryboard storyboardWithName:@"SecondStoryboard" bundle:[NSBundle mainBundle]];
    UITabBarController *rootTabBarController = (UITabBarController *)[mainSB instantiateInitialViewController];

    dispatch_sync(dispatch_get_main_queue(), ^{

        ...

        self.view.window.rootViewController = rootTabBarController;

This Second story board contains a tabbar controller with a split view controller inside it:

All works but there is a strange behaviour of navbar controller inside the splitview controller. Its back button works if pressed but doesn't display properly because there is only the "back" text without the left arrow.

]3

Only after few minutes and some transitions between master and detail view the back button display properly with the left arrow.

(All works correctly if I use only the Second storyboard from the startup)

I Know that in this case I can use only one storyboard but I want to know if is not correct to work in this way with multiple storyboards or if it's a bug.

解决方案

With the new Xcode 7 Beta and iOS 9 all perfectly work.

Whit the same configuration of files the chevron of navigation controller display properly. I don't know why, Apple in this WWDC has released the storyboard reference, but I think that was a bug of UISplitViewController.

这篇关于UISplitViewController 和 UINavigationController 无法与多个故事板一起正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆