OGeek|极客世界-中国程序员成长平台

标题: ios - 在 UISplitView 中跨多个详细 View 维护弹出窗口 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 22:25
标题: ios - 在 UISplitView 中跨多个详细 View 维护弹出窗口

在我的应用委托(delegate)中,我创建了一个 UISplitViewController。我将委托(delegate)设置为 detailViewController。

当我纵向运行我的应用程序时,我会显示左上角的弹出按钮,该按钮将滑出 Split View母版。

然后我的详细 View 中有一个按钮,它使用新的详细 View Controller 重置 splitviewcontroller 数组并将 Split View委托(delegate)设置为该 Controller 。

第二个详细 View 正确显示...但我丢失了第二个 View Controller 上的弹出按钮。

有谁知道如何让该按钮保留在我可能添加的所有细节 View Controller 上?

谢谢!



Best Answer-推荐答案


http://www.raywenderlich.com/forums/viewtopic.php?f=2&t=1546我认为这是一个很好的方法。

它涉及将SplitViewController 委托(delegate)设置为master 而不是detail。 master 保持对 popoverController 和按钮的引用,每次调用委托(delegate)方法(隐藏和显示 master)时,它都会获取当前的详细 View 并执行必要的操作(添加按钮/删除按钮和 popovercontroller)。

master 为 "SubstituableDetailView"定义了一个协议(protocol),其中包含显示/隐藏按钮的两种方法。

关于ios - 在 UISplitView 中跨多个详细 View 维护弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9996036/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4