UINavigationController 层级
2016-01-18 本文已影响279人
穷小子
UINavigationController_1.png
UINavigationController_2.png
UINavigationController
常用方法
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated;
- (nullable UIViewController *)popViewControllerAnimated:(BOOL)animated;
- (nullable NSArray<__kindof UIViewController *> *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated;
- (nullable NSArray<__kindof UIViewController *> *)popToRootViewControllerAnimated:(BOOL)animated;
常用属性
@property(nullable, nonatomic,readonly,strong) UIViewController *topViewController;
@property(nullable, nonatomic,readonly,strong) UIViewController *visibleViewController;
@property(nonatomic,copy) NSArray<__kindof UIViewController *> *viewControllers;
@property(nonatomic,readonly) UINavigationBar *navigationBar;
@property(nonatomic,getter=isToolbarHidden) BOOL toolbarHidden NS_AVAILABLE_IOS(3_0) __TVOS_PROHIBITED;
UINavigationBar
常用属性
@property(nullable, nonatomic,strong) UIColor *barTintColor NS_AVAILABLE_IOS(7_0) UI_APPEARANCE_SELECTOR;
// NSString *const UITextAttributeFont; value: UIFont
// NSString *const UITextAttributeTextColor; value: UIColor
// NSString *const UITextAttributeTextShadowColor; value: UIColor
// NSString *const UITextAttributeTextShadowOffset; value: NSValue wrapping a UIOffset struct.
@property(nullable,nonatomic,copy) NSDictionary<NSString *,id> *titleTextAttributes NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
UIViewController (UINavigationControllerItem)
常用属性
@property(nonatomic,readonly,strong) UINavigationItem *navigationItem;
@property(nonatomic) BOOL hidesBottomBarWhenPushed __TVOS_PROHIBITED;
@property(nullable, nonatomic,readonly,strong) UINavigationController *navigationController;
简介
navigationItem
是UIViewController
的一个属性,这个属性是为UINavigationController
服务的。
“The navigation item used to represent the view controller in a parent’s navigation bar. (read-only)”,
即navigationItem
在navigation Bar
代表一个viewController
.
UINavigationItem
常用属性
@property(nullable, nonatomic,copy) NSString *title;
@property(nullable, nonatomic,strong) UIView *titleView;
@property(nullable,nonatomic,copy) NSString *prompt __TVOS_PROHIBITED;
@property(nullable,nonatomic,strong) UIBarButtonItem *backBarButtonItem __TVOS_PROHIBITED;
@property(nonatomic,assign) BOOL hidesBackButton __TVOS_PROHIBITED;
@property(nullable,nonatomic,copy) NSArray<UIBarButtonItem *> *leftBarButtonItems NS_AVAILABLE_IOS(5_0);
@property(nullable,nonatomic,copy) NSArray<UIBarButtonItem *> *rightBarButtonItems NS_AVAILABLE_IOS(5_0);