开发者

How do I change TabBarController behavior?

开发者 https://www.devze.com 2023-02-26 08:04 出处:网络
I\'m an iPhone newbie and for my first application I need to override the normal behavior of TabBarController.

I'm an iPhone newbie and for my first application I need to override the normal behavior of TabBarController. I have 3 tabs and on the first one I need to load a different view according to some logic at runtime. Is this possible?

I had a look at the TabBarController delegate but as far as I understand it doesn't allow beh开发者_运维问答avior override, just "notification on user input".

Any idea? Thank you.


To change the controller in a particular tab, you do:

NSMutableArray* controllers = [NSMutableArray arrayWithArray:tabBarController.viewControllers];

int newIndex = 0;
[controllers replaceObjectAtIndex:newIndex withObject:newController];

tabBarController.viewControllers = controllers;
0

精彩评论

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