gpt4 book ai didi

objective-c - 两个 UISplitViewController,1 个(共享)详细 View

转载 作者:太空狗 更新时间:2023-10-30 03:54:12 27 4
gpt4 key购买 nike

设置场景我有:

  • 带有 2 个选项卡的选项卡 View Controller
  • 每个选项卡都有一个 Split View Controller
  • 我想将每个 Split View Controller 的 Detail view 指向相同的 View 。

我附上了一个非常简单的 sample project showing the issue .

在 iPad 5.1 Sim 中运行它,观察每个选项卡。一个显示共享详细信息 View ,一个失败。

NSLog 调试报告第二个 Split View有一个 NULL 详细 View Controller :

2012-04-28 07:21:55.451 svcTest[14597:f803] tabBarController viewControllers = (    "UISplitViewController: 0x6a36100",    "UISplitViewController: 0x6a39ab0")2012-04-28 07:21:55.455 svcTest[14597:f803] svcA.viewControllers = (    "UINavigationController: 0x6a36250",    "UIViewController: 0x6a38720")2012-04-28 07:21:55.457 svcTest[14597:f803] svcB.viewControllers = (    "UINavigationController: 0x6a39cc0")

当您单击第二个选项卡时,出现此错误:

2012-04-28 07:22:58.457 svcTest[14597:f803] Splitview controller  is expected to have a detail children before its used!2012-04-28 07:22:58.459 svcTest[14597:f803] Split view controller  should have its children set before layout!

看 Storyboard,我已经设置了细节 View ,所以这让我很困惑。

Storyboard

非常感谢任何帮助让这个“共享” View 显示在每个选项卡上的帮助。

谢谢!

最佳答案

当为 splitViewController 指定两个以上的 viewController 时,我收到了相同的警告,如下所示:

self.splitViewController.viewControllers = @[masterNavigationController, detailNavigationController, subViewController];

当我从数组中删除“subViewController”时,警告消失了。

阅读苹果关于添加/删除 subview 的文档后,它提到了以下内容:

The array in this property must contain exactly two view controllers. The view controllers are presented left-to-right in the split view interface when it is in a landscape orientation. Thus, the view controller at index 0 is displayed on the left side and the view controller at index 1 is displayed on the right side of the interface.

您可以查看指向 UISplitViewController Class Reference 的链接获取更多信息。

关于objective-c - 两个 UISplitViewController,1 个(共享)详细 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10358111/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com