开发者

How to properly use a UITabBarController in Monotouch

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜