工具栏隐藏在旋转的 UISplitView DetailView 上
我的应用程序基于 Apple 的 SplitView 项目类型。我有一个 TableView 作为主视图,并使用不同类型的视图作为详细视图。为了选择详细视图的类型,我使用了详细视图工具栏上按钮的奇特概念。当 DetailView 派生自 UIViewController 时,一切都很好。当 DetailView 派生自 UIViewController 但包含 UITableView 时,我就会遇到问题。在纵向视图中,工具栏可见。在横向模式下,工具栏是隐藏的,即使表格视图向下移动以为其留出空间。 UIToolbar 和 UITableView 都在我的 NIB 文件中定义,该文件被加载以创建详细视图。为什么我的工具栏在横向模式下不可见?
顺便说一句,这是使用 UISplitView 选择详细视图类型的最佳方式吗?额外的问题,如果在 DetailView 表视图中选择一行应该调出另一个视图,我无法像使用 NaviagtionController 那样推送它,那么我该如何返回详细表视图呢?
谢谢,格里
I've based my app on Apple's SplitView project type. I have a TableView as the Master, and am using different types of views as the Detail view. To select types of detail view, I'm using the fancy concept of buttons on my DetailView toolbar. When the DetailView is derived from UIViewController, everything is good. When the DetailView derives from UIViewController, but contains a UITableView then I have problems. In portrait view the toolbar is visible. In landscape mode the toolbar is hidden, even though the Tableview is moved down to allow space for it. The UIToolbar and UITableView are both defined in my NIB file which is loaded to create the detail view. Why is my toolbar invisible in landscape?
BTW, is this the best way to choose Detail view types with UISplitView? Bonus question, what if selecting a row in my DetailView tableview should bring up another View, I can't push it like I would with a NaviagtionController, so how do I go back to the detail tableview?
Thanks, Gerry
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
嗨,格里,
我遇到了同样的工具栏问题,当尝试旋转 splitView 时,工具栏将消失。如果您要在界面生成器中创建工具栏,请尝试通过选择工具栏来设置工具栏属性(大小),然后 -->工具-->尺寸检查器,在自动调整尺寸部分,标记左、右、上红线,取消标记下红线,然后一切正常。
-玛丽亚
HI Gerry,
I have faced the same toolbar problem, when trying to rotate the splitView, toolbar will disappear. If you are creating the toolbar in the interface builder, try to set the toolbar properties(size), by selecting the toolbar, then --> Tools -->Size inspector, in the autosizing section, mark the left, right and upper red lines and unmark the bottom red line, then everything will works fine.
-Maria
只是一个提示,但每当我遇到这样的奇怪事情时,我都会从 NIB 文件中删除元素并在代码中以编程方式创建它们,通常可以解决问题。当你这样做时,你可以更好地控制事情。总的来说,随着我在 iPhone OS 编程方面获得了更多经验,我发现我很少再在 NIB 文件中投入太多内容,现在几乎所有事情都用代码完成。
Just a tip but whenever I run into odd things like this I remove the elements from the NIB file and create them programmatically in code and it usually solves the problem. You get a lot more control over things when you do. Overall as I've gained more experience with programming for iPhone OS I've found that I rarely put much into a NIB file any longer and do almost everything in code now.