UITabBarController和UITabBarControllerDelegate

NS_CLASS_AVAILABLE_IOS(2_0) @interface UITabBarController : UIViewController <UITabBarDelegate, NSCoding> 

@property(nonatomic,copy) NSArray *viewControllers;

// If the number of view controllers is greater than the number displayable by a tab bar, 
// a "More" navigation controller will automatically be shown.
// The "More" navigation controller will not be returned by -viewControllers, 
// but it may be returned by -selectedViewController.
- (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated;

// This may return the "More" navigation controller if it exists.
//The view controller associated with the currently selected tab item
@property(nonatomic,assign) UIViewController *selectedViewController; 

//The index of the view controller associated with the currently selected tab item.
@property(nonatomic) NSUInteger selectedIndex;

// Returns the "More" navigation controller, creating it if it does not already exist.
@property(nonatomic,readonly) UINavigationController *moreNavigationController; 

// If non-nil, then the "More" view will include an "Edit" button that displays 
// customization UI for the specified controllers. By default, all view controllers are customizable.
@property(nonatomic,copy) NSArray *customizableViewControllers;

// Provided for -[UIActionSheet showFromTabBar:]. 
// Attempting to modify the contents of the tab bar directly will throw an exception.
@property(nonatomic,readonly) UITabBar *tabBar NS_AVAILABLE_IOS(3_0); 

@property(nonatomic,assign) id<UITabBarControllerDelegate> delegate;

@end

@protocol UITabBarControllerDelegate <NSObject>
@optional

//Asks the delegate whether the specified view controller should be made active.
- (BOOL)tabBarController:(UITabBarController *)tabBarController 
                          shouldSelectViewController:(UIViewController *)viewController NS_AVAILABLE_IOS(3_0);

//Tells the delegate that the user selected an item in the tab bar.
- (void)tabBarController:(UITabBarController *)tabBarController 
                          didSelectViewController:(UIViewController *)viewController;

//Tells the delegate that the tab bar customization sheet is about to be displayed.
- (void)tabBarController:(UITabBarController *)tabBarController 
                          willBeginCustomizingViewControllers:(NSArray *)viewControllers NS_AVAILABLE_IOS(3_0);

//Tells the delegate that the tab bar customization sheet is about to be dismissed.
- (void)tabBarController:(UITabBarController *)tabBarController 
                          willEndCustomizingViewControllers:(NSArray *)viewControllers 
                          changed:(BOOL)changed NS_AVAILABLE_IOS(3_0);

//Tells the delegate that the tab bar customization sheet was dismissed.
- (void)tabBarController:(UITabBarController *)tabBarController 
                          didEndCustomizingViewControllers:(NSArray *)viewControllers
                          changed:(BOOL)changed;
@end

@interface UIViewController (UITabBarControllerItem)

// Automatically created lazily with the view controller's title if it's not set explicitly.
@property(nonatomic,retain) UITabBarItem *tabBarItem; 

// If the view controller has a tab bar controller as its ancestor, return it. Returns nil otherwise.
@property(nonatomic,readonly,retain) UITabBarController *tabBarController; 

@end

你可能感兴趣的:(UITabBarController和UITabBarControllerDelegate)