How do I change TabBarController behavior?
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;
精彩评论