UISplitViewController无法更改主视图控制器? [英] UISplitViewController Cannot Change the Master View Controller?

查看:114
本文介绍了UISplitViewController无法更改主视图控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在UISplitViewController中更改主视图控制器(以纵向显示在popover中,在横向中显示在左侧)。我想在主视图控制器是两个不同的UIViewControllers之一之间切换(取决于我的应用程序中的其他地方采取的操作)。

I am trying to change the master view controller (that appears in the popover in portrait, and on the left side in landscape) in a UISplitViewController. I'd like to switch between the master view controller being one of two different UIViewControllers (depending on an action taken elsewhere in my application).

我使用以下内容:


mySplitViewController.viewControllers = [NSArray arrayWithObjects:newMasterController,detailController,nil];

mySplitViewController.viewControllers = [NSArray arrayWithObjects:newMasterController, detailController, nil];

这正确地改变了主视图控制器,就像在横向模式下一样。但是似乎在纵向模式下更改用于弹出框的视图控件。

This correctly changes the master viewcontroller as you would expect in landscape mode. However it does not seem to change the viewcontroller used for the popover in portrait mode.

我注意到barbuttonitem显示此主视图控制器只是在splitviewcontroller上调用showMasterInPopover:所以期望它也可以在纵向模式下工作,但事实并非如此。

I notice that the barbuttonitem to show this master view controller is just calling showMasterInPopover: on the splitviewcontroller, and so would expect it to work in portrait mode as well, but it does not.

事实上,我可以设置主视图控制器,在横向模式下正确查看 new viewController,旋转返回 to portrait,popover中使用的viewcontroller仍然是旧的。

In fact, I can set the master view controller, see the new viewController correctly in landscape mode, rotate back to portrait, and the viewcontroller used in the popover is still the old one.

这是一个错误吗?

推荐答案

如果有人正在寻找这个问题的解决方案(或一个单词),我有一个类似的问题,并在这里解决:< a href =https://stackoverflow.com/questions/8610132/changing-the-master-view-in-split-view-does-not-update-the-popover-in-portrait>更改主视图拆分视图不会更新纵向中的弹出窗口

In case anyone is looking for a solution to this issue (or a word-around), I had a similar issue and worked it out here: Changing the master view in Split View does not update the popover in portrait

基本上,我使用导航控制器作为主视图控制器,并在该导航中使用推/视图控制器控制器,以便在弹出视图中更改主视图中的视图控制器,同时仍然以纵向显示正确的视图控制器。

Basically, I used a navigation controller for the master view controller, and pushed/poped view controllers within that navigation controller, in order to change view controllers in the master view whilst still displaying the correct viewcontroller in portrait orientation, in the popup view.

这篇关于UISplitViewController无法更改主视图控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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