开发者

Multiple View Controllers for a TabBarItem

I have a TabBarController with 5 Tabs. One of the Tabs "Info" has a ViewController (as always).

The View in this ViewContoller has 3 buttons - Info1, Info2 and Info3. The TabController is set to load "Info1" as default. When clicking these buttons, each should open a new ViewController and it´s View. It should not be "modal" but should belong to the TabBar Controller (so the TabBar is visible and working). I do not wan´t a navigation Controller since the buttons could be pressed in any order.

Is it possible to: - Change/replace a ViewController for the "Info"-tab?

I noticed in Apple dokumentation that ALL Viewcontrollers for a TabBarController could be set/changed. But isn´t there a way to change only one of 开发者_Go百科them?

Anyway: I REALLY appreciate the stackoverflow site! I have found a ton of tips that helped me developing apps. There is only good answers and good manners all over. This is my first question here. Thanks!


The easiest would be to make this in interface builder, then you could just drag the view-controllers into the tab bar, then it becomes buttons. It's really easy!

If you would like to make it programaticaly as the app starts up, you could make UITabBarItems, and implement the UITabBarDelegate and watch for "tabBar:didSelectItem:"

But, as i said. Interface builder is the simplest!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜