TabBar ( UITabBarController ) 中的 UISplitViewController ?
我所处的情况是,我需要从基于选项卡的应用程序开始,并且我需要一个或多个选项卡的拆分视图。但似乎分割视图控制器对象无法添加到 tabbarController 中。 (尽管可以将 tabbar 对象添加到 splitviewcontroller 中)。
问题可以从其他方面来看:我的左侧有一个全屏,当在表中选择任何行时,我有一个表视图,应该出现一个弹出窗口来指向该行。现在,当选择弹出窗口中的任何行时,该弹出窗口中的行将出现在所选行下方的左侧(只有该行可见),并且另一个弹出窗口会从所选行中出现。 (面包屑导航类型)
我想我的解释很清楚。那么大家有什么想法或解决方法吗?
如果我的问题不清楚,请告诉我。
谢谢,
马杜普
I am in kind of situation that I need to start with a tab based application and in that I need a split view for one or more tabs. But it seems that split view controller object can not be added to the tabbarController. (Although tabbar object can be added to the splitviewcontroller).
The problem can be seen otherways: I have a full screen in the left part I have a table view when any row is selected in the table a popover should come out pointing that row. Now when any row in the popover is selected the rows in this popover comes to the left under the selected row (only this row would be visible) and another popover comes out from the selected row. (Breadcrumb navigation type)
I think I am clear in what I explained. So guys any ideas or work arounds?
Please let me know if I am not clear in my question.
Thanks,
Madhup
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
使用界面生成器,创建一个分割视图控制器和一个选项卡栏控制器,并将它们链接到您的插座:
在您的应用程序委托
didFinishLaunchingWithOption
中,将您的分割视图控制器分配给选项卡栏控制器:这将创建一个选项卡栏控制器(在本例中只有 1 个选项卡),在所有方向上都能正确显示。
Using the interface builder, create a split view controller and a tab bar controller and link them to your outlets:
In your app delegate
didFinishLaunchingWithOption
, assign your split view controller to the tab bar controller:This will create a tab bar controller (with only 1 tab in this case), which is displayed correctly in all orientations.
我已经为 UISplitViewController 编写了一个子类,它将侦听设备方向的更改并相应地调整自身方向。有了这个类,我现在可以将分割视图放置在 UITabBarController 中,并且每个分割视图在旋转时都会正确运行,即使它不是最前面的选项卡。我已在 TexLege 中成功部署此程序,并已获准在 App Store 中使用,但您的情况可能会有所不同。请参阅 Github 上的存储库。
请随意分叉和修改它,我总是有兴趣听到有关它的评论(或投诉)。 https://github.com/grgcombs/IntelligentSplitViewController
I've written up a subclass for the UISplitViewController that will listen for changes to device orientation and orient itself accordingly. With this class, I can now place split views within a UITabBarController and each split view will behave correctly upon rotation, even if it's not the frontmost tab. I've successfully deployed this in TexLege and it was approved for use in the App Store, but your mileage may vary. Please see the repository at Github.
Feel free to fork and modify it, and I'm always interested in hearing comments (or complaints) about it. https://github.com/grgcombs/IntelligentSplitViewController
我做了一个示例应用程序。并发现我们可以通过编程方式做到这一点,例如:
希望这会有所帮助。
I made a sample application. and found we can do it programmatically like:
Hope this helps.
要让 tabbarcontroller 显示为 splitviewcontroller 的主视图,您应该重写 tabbarcontroller 以便它支持或方向(也就是说,使用 UITabBarController 类的类别)
To let a tabbarcontroller appear as a master view for splitviewcontroller you should rewrite tabbarcontroller so that it will support or orientations(so say, using a category for the class UITabBarController)
请参阅我关于将拆分视图控制器改造为现有选项卡栏界面的文章:http ://markivsblog.blogspot.com/2010/04/retrofitting-ipad-uisplitviewcontroller.html
See my post about retrofitting split view controllers to an existing tab bar interface: http://markivsblog.blogspot.com/2010/04/retrofitting-ipad-uisplitviewcontroller.html
我创建了一个 UITabBarController 子类,它将旋转消息正确传播到它包含的所有 UISplitViewController。这可以维护 UISplitViewController 的正确内部状态。但是,如果 SplitViewController 不可见,则不会调用 SplitViewController 委托方法之一,因此我在详细视图控制器 viewWillAppear 方法中考虑了这一点。我已经确认这适用于 iOS5.0 - iOS6.1
OSTabBarController.m
DetailViewController
I created a UITabBarController subclass which properly propagates the rotation messages to all UISplitViewControllers it contains. This maintains the correct internal state of the UISplitViewControllers. However, one of the SplitViewController delegate methods is not called if the SplitViewController is not visible, so I account for this in the detail view controller viewWillAppear method. I've confirmed this works in iOS5.0 - iOS6.1
OSTabBarController.m
DetailViewController
请记住,OS 3.2 没有为作为选项卡栏视图的 splitview 提供适当的支持。
您可以使其“工作”,但它会有错误 - 最大的是在另一个选项卡视图上进行的方向更改通常不会正确传播到 splitview 选项卡视图,从而使当您返回到它时视图变得古怪(左侧)视图占据屏幕,或者栏按钮项目丢失等)。
我得出的结论是,由于这个问题,我必须创建自己的 splitview 以在 tabBarController 中使用。
我听说有传言称 Apple 正在修复此问题,但几个月过去了,iPad 操作系统还没有更新——也许 iPad 的 OS 4 会解决这个问题。
Keep in mind that OS 3.2 does not provide proper support for a splitview as a tabbar view.
You can make it "work" but it will have bugs - the biggest is that an orientation change made on another tab's view will often not propagate to the splitview tab view properly, making the view go wacky when you go back to it (left side view takes over the screen, or the barbutton item is missing, etc.).
I've reached the conclusion that I have to create my own splitview for use in a tabBarController because of this issue.
I had heard rumors that Apple was working on a fix but it's been months now and no iPad OS updates have occurred - maybe OS 4 for the iPad will address it.
可以使用IB构建tabtab并修改tabs到splitviewcontroller。
}
You can use IB to build tabtab and modify tabs to splitviewcontroller.
}
我们成功地在 iOS5+ 的 iPad 上的 UITabViewController 中添加了 UISplitViewController。
长话短说:它有效:
工作,如果你想让主视图隐藏在纵向中,并且
仅在点击按钮时才出现。
第二种情况的技巧是使用IntelligentSplitViewController(参见一些帖子,感谢Greg Combs)或类似地扩展UISplitVC,并注意splitview控制器子类的委托始终是一个活动对象。
我们详细介绍了该过程:
https://devforums.apple.com/message/763572#763572< /a>
We succeeded in having a UISplitViewController inside a UITabViewController on iPad with iOS5+.
to make a long story short: it works:
work, if you want to have the master view hidden in portrait, and
have it appear only upon tapping a button.
The trick in the second case is to use the IntelligentSplitViewController (see a few posts up, thanx Greg Combs) or similarly extend a UISplitVC, and be careful that the delegate of the subclass of the splitview controller is always a live object.
We have detailed the process on:
https://devforums.apple.com/message/763572#763572