Can't add a UISplitView as a Tab Item in IB?
Is there a reason why I can't add a UISplitviewController as the child of a UITabBarController in Interface Builder?
I realize I could do this programat开发者_开发问答ically, but all of a sudden I'm questioning if this is a legit way to go.
This is what I'm planning on doing:
- Create a Master View Controller (UITableViewController with accompanying NIB)
- Create a Detail View Controller (UIViewController with accompanying NIB)
- Subclass UISplitviewController
- Attached the above to my Tab Bar Controller instance in Interface Builder by adding a UIViewController instance as a child, then changing the class name to my splitviewCont subclass (in Interface Builder).
This sounds kind of boneheaded to me. Is there a "recommended" way to go about this?
This has been discussed ad nauseam in several questions here on Stack Overflow (e.g. in one of my own questions)
The bottom line: a UISplitViewController
must be the root view of an app (or perhaps more specifically, a window). It can not live inside a UITabBarController
or anything else. If you try to add it in Interface Builder, you will quickly see it can't be done. If you do it from code, you will get compile-time or run-time errors.
You can, however, put a tab bar inside the split view's master (left) side.
精彩评论