#import <Foundation/Foundation.h>
#import <UIKit/UIViewController.h>
#import <UIKit/UIViewControllerTransitioning.h>
#import <UIKit/UIKitDefines.h>
#import <UIKit/UITabBar.h>
@class UIView, UIImage, UINavigationController, UITabBarItem;
@protocol UITabBarControllerDelegate;
#pragma - mark - 声明
NS_CLASS_AVAILABLE_IOS(2_0) @interface UITabBarController : UIViewController <UITabBarDelegate, NSCoding>
@property(nonatomic,copy) NSArray *viewControllers; // 所有子控制器
- (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated;
@property(nonatomic,assign) UIViewController *selectedViewController; // 选中的控制器
#pragma - mark 通过index切换选中的控制器
@property(nonatomic) NSUInteger selectedIndex;
// 如果子控制器太多。会自动将一部分子控制器放入一个 UINavigationController 中,并显示 More 按钮,不要手动让其显示在界面上,系统自动执行;
@property(nonatomic,readonly) UINavigationController *moreNavigationController;
@property(nonatomic,copy) NSArray *customizableViewControllers;
@property(nonatomic,readonly) UITabBar *tabBar NS_AVAILABLE_IOS(3_0);
@property(nonatomic,assign) id<UITabBarControllerDelegate> delegate;
@end
#pragma - mark - 代理方法
@protocol UITabBarControllerDelegate <NSObject>
@optional
// 控制器是否能被选中
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController NS_AVAILABLE_IOS(3_0);
// 已经选中一个控制器后执行的方法
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController;
- (void)tabBarController:(UITabBarController *)tabBarController willBeginCustomizingViewControllers:(NSArray *)viewControllers NS_AVAILABLE_IOS(3_0);
- (void)tabBarController:(UITabBarController *)tabBarController willEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed NS_AVAILABLE_IOS(3_0);
- (void)tabBarController:(UITabBarController *)tabBarController didEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed;
- (NSUInteger)tabBarControllerSupportedInterfaceOrientations:(UITabBarController *)tabBarController NS_AVAILABLE_IOS(7_0);
- (UIInterfaceOrientation)tabBarControllerPreferredInterfaceOrientationForPresentation:(UITabBarController *)tabBarController NS_AVAILABLE_IOS(7_0);
- (id <UIViewControllerInteractiveTransitioning>)tabBarController:(UITabBarController *)tabBarController
interactionControllerForAnimationController: (id <UIViewControllerAnimatedTransitioning>)animationController NS_AVAILABLE_IOS(7_0);
- (id <UIViewControllerAnimatedTransitioning>)tabBarController:(UITabBarController *)tabBarController
animationControllerForTransitionFromViewController:(UIViewController *)fromVC
toViewController:(UIViewController *)toVC NS_AVAILABLE_IOS(7_0);
@end
@interface UIViewController (UITabBarControllerItem)
@property(nonatomic,retain) UITabBarItem *tabBarItem;
@property(nonatomic,readonly,retain) UITabBarController *tabBarController;
@end
UITabBarController.h
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- objc-runtime.h 中代码: #include <objc/runtime.h> #include<ob...
- 一、安装mosquitto1.4的时候使用make的时候报以下错误: mosquitto_internal.h:4...
- 首先保证你的Bridgind-Header.h文件的路径引用正确 检验该文件是否导入正确的方法:.h文件中不要im...
- 马云“爸爸”在上周的第三届世界互联网大会上又“一鸣惊人”了。作为全球最大电子商务集团的管理者,马云却对电商的前景表...