将 Popover 视图连接到 iPad 的详细信息视图

发布于 2024-11-30 12:22:03 字数 347 浏览 1 评论 0原文

我有 UISplitViewController,我想从位于 UIPopoverController 中的 UIViewController 进行更新。

当我选择主 VC 中与详细 VC 连接的单元格(拆分视图中的左表)时,我使用以下命令:

DetailViewControlleriPad *dvc = [[self.splitViewController viewControllers] objectAtIndex:1];
dvc.detailItem = object;

但是,我尝试在弹出窗口中执行此操作,但它不会更新详细信息视图。有没有办法做到这一点,或者我只能从主视图更新详细视图?

I have UISplitViewController that I want to be updated from a UIViewController that is housed in a UIPopoverController.

When I select a cell in the master VC (the left table in a split view) connected with the detail VC, I use this:

DetailViewControlleriPad *dvc = [[self.splitViewController viewControllers] objectAtIndex:1];
dvc.detailItem = object;

However, I tried doing this in the popover, but it doesn't update the detail view. Is there a way to make this work, or can I only update the detail view from the master view?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

虐人心 2024-12-07 12:22:03

您可以尝试拨打:

[dvc.view setNeedDisplay];

You could try to call:

[dvc.view setNeedDisplay];
满天都是小星星 2024-12-07 12:22:03

您应该实现 UISplitViewControllerDelegate 并使用其方法获取对根视图控制器和详细视图控制器的引用。

另一种方法是始终在根视图控制器中引用详细视图控制器(从 IB 的开头或通过代码),而不是尝试在 splitviewcontroller 的视图层次结构中找到它。

You should implement UISplitViewControllerDelegate and use its methods to get a reference to the root view controller and detail view controller.

Another method would be to always have a reference to your detailviewcontroller in the root view controller (from the beginning in IB or through code) instead of trying to find it in the splitviewcontroller's view hierarchy.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文