From iPhone Development Wiki
Revision as of 06:58, 1 February 2011 by Chpwn (talk | contribs) (fix my typo)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

UITabBarController is a class used for managing a UITabBar within a UIViewController hierarchy.

-[UITabBarController _setSelectedViewController:]

This method is the main method used for managing selection. It's called, sometimes indirectly, when you tap an item in the tab bar or change the selected controller programatically (even via -setSelectedIndex:). However, popping back to the root controller and similar tasks are handled by other methods.

A reverse-engineered code listing follows:

- (void)_setSelectedViewController:(UIViewController *) {
    if (_transientViewController == nil || _transientViewController == controller) return;
    if (_selectedViewController == controller) return;
    BOOL moreController = [[[self moreNavigationController] moreViewControllers] containsObject:controller];
    [self _setSelectedTabBarItem:[controller tabBarItem]];
    [self transitionFromViewController:_selectedViewController toViewController:controller];
    if (moreController && [self _allowSelectionWithinMoreList])
        [[self moreNavigationController] setDisplayedViewController:nil];
    if (__UIApplicationLinkedOnOrAfter(4) && [[self delegate] respondsToSelector:@selector(tabBarController:didSelectViewController:)])
        [[self delegate] tabBarController:self didSelectViewController:controller];