在 Xcode 4.2 中使用带有故事板的 UISplitView 中的多个详细视图?
我正在尝试创建一个带有使用多个详细视图的 SplitView 控制器的 iOS 5 应用程序。这就是问题所在。我正在尝试使用故事板来做到这一点。我发现许多教程解释了如何在以前版本的 Xcode 中执行此操作,但没有一个涉及 Storyboard。
一个例外是在主视图中创建一个选项卡栏控制器,这不是我想要使用的东西。我尝试删除标签栏并修改代码,但没有成功。
我确实发现我可以将替换 Segue 附加到主视图中的静态单元格。它允许我将类型指定为详细拆分,这完成了我想要做的大部分事情。它加载新的细节控制器。
但是,显示主弹出窗口的按钮在转换过程中消失。我相信我可以使用以下方法防止这种情况发生:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
不幸的是,我不确定要在那里放置什么代码来防止按钮消失。我是否需要每个细节控制器以某种方式作为主控制器的代表?
有没有人获得多个详细视图来使用故事板工作,如果是的话,您能给我指出一个好的教程的方向吗?非常感谢您的帮助!
I'm trying to create an iOS 5 application with a SplitView Controller that uses multiple detailviews. Here's the rub. I'm trying to do it using Storyboards. I've found a number of tutorials explaining how to do it in previous versions of Xcode, but none addressing Storyboards.
The one exception creates a tab bar controller in the master view, which is not something I want to use. I tried removing the tab bar and modifying the code but was unsuccessful.
I did figure out that I could attach a replace Segue to a static cell in the master view. It allows me to specify the type as a detail split, which accomplishes most of what I'm trying to do. It loads the new detail controller.
However, the button that shows the master popover disappears during he transition. I believe I can probably prevent that from happening using this method:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
Unfortunately, I'm not sure exactly what code to place there to prevent the button from disappearing. Do I need each detail controller as a delegate to the master somehow?
Has anyone gotten multiple detail views to work using storyboards and if so can you point me in the direction of a good tutorial? Thank you so much for the help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我遇到了类似的情况,并检查了 raywenderlich.com 的链接。然而,我发现管理 splitview delegate 有点过于复杂,并且它使得 iPhone 和 iPad 之间的重用变得困难。我的解决方案是创建一个DetailedContainerViewController 作为右侧视图控制器。并将要显示在右侧的视图控制器添加为容器控制器的子视图控制器。这样,只有DetailedContainerViewController需要实现SplitView委托。所以不需要担心委托。
看一下我在github上写的示例代码:
https://github.com/raoying/SplitView-Sample
I faced a similar situation and checked the link to the raywenderlich.com. However I found managing the splitview delegate kind of too complicated, and it makes reuse between iPhone and iPad difficult. My solution is to create a DetailedContainerViewController as the right side view controller. And add the view controllers to be displayed on the right side as the child view controllers of the container controller. In this way only the DetailedContainerViewController needs to implement the SplitView delegate. So there is no need to worry about the delegate.
Take a look at the sample code I wrote on github:
https://github.com/raoying/SplitView-Sample