I understand what to do when using a UITabBarController with the MainWindow. But if when I'm in IB and I decide I want to have a UITabBarController, I only ever get a UIViewController that has a UITabBarController. If this is how it needs to be, then when do I .AddSubVi开发者_如何学Pythonew of the UITabBarController? In the ViewWillLoad of the UIViewController? Do I just change the class that is inherited from in the code?
Bit lost here.
This is what I do:
- derive from UITabBarController in IB
- add the new class to my XIB
- (if I want to add new tabs outside of IB, I override LoadView in my tab bar controller class and do it in there)
- in AppDelegate.FinishedLaunching, I add my tab bar's view as a subview of 'window' (ie window.AddSubview(mainTabBar.View); )
Those steps work for me without any obvious problems.
精彩评论