#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...
- 馬云“爸爸”在上周的第三屆世界互聯網大會上又“一鳴驚人”了。作為全球最大電子商務集團的管理者,馬云卻對電商的前景表...