如何让 UISplitViewController 在两个方向上显示相同
我正在编写我的第一个 Tabbar iPad 应用程序,其中添加了分割视图控制器。一切工作正常,但问题是每当视图以纵向模式加载时,我都试图显示根视图控制器和详细视图控制器。非常清楚的是,我需要两个控制器以与横向模式下相同的方式显示。如果有办法或有任何其他想法,请告诉我伙计们,这对我有帮助。
我查看了 MGSplitViewController 但将其作为最后一个选项。
感谢您抽出时间。
I am writing my first tabbar iPad application to which split view controller is added. Everything is working fine but the problem is I am trying to display the root view controller and detail view controller whenever the view gets loaded in portrait mode. To be very clear, I need two controllers to appear the same way as they would appear in landscape mode. Please let me know guys, if there is a way to do it or any other thoughts you have so that it will be helpful for me.
I look at MGSplitViewController but left it as a last option.
Thanks for your time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我所做的是在详细视图(将以纵向模式显示的表格视图)内添加一个 TableView。我将此 TableView 连接到我的数据源,以便显示相同的数据。当应用程序旋转到横向时,我只需在 willRotateToInterfaceOrientation 中将 TableView 的 alpha 设置为 0,并在旋转到纵向时将其设置回 1。
唯一的缺点是,当您将两个表连接到同一数据源时,会出现警告“已经有一个子表履行此角色”。但这只是一个警告,我的应用程序已经在 iTunes 商店中并且运行良好,没有崩溃。
What I did was to add a TableView inside the Detail View (the table View that would be displayed in Portrait Mode). I hooked this TableView to my data source so the same data would be displayed. And when the App rotates to landscape I just set the alpha of the TableView to 0 in willRotateToInterfaceOrientation, and back to 1 when it rotates to Portrait.
The only disadvantage is that there is a warning when you hook up two tables to the same data source "already has a child fulfilling this role". But its just a warning, my App is already in iTunes store and running fine without crashes.