IOS學習筆記-UINavgationController,
Creating Navigation Controllers
- (instancetype)initWithRootViewController:(UIViewController *)rootViewController
參數:UIViewController
方法:initWithNavigationBarClass:toolbarClass
Initializes and returns a newly created navigation controller that uses your custom bar subclasses.
- (instancetype)initWithNavigationBarClass:(Class)navigationBarClass
toolbarClass:(Class)toolbarClass
參數:navigationBarClass、toolbarClass
屬性:topViewController
The view controller at the top of the navigation stack. (read-only)
@property(nonatomic, readonly, retain) UIViewController *topViewController
屬性:visibleViewController
The view controller associated with the currently visible view in the navigation interface. (read-only)
@property(nonatomic, readonly, retain) UIViewController *visibleViewController
屬性:viewControllers
The view controllers currently on the navigation stack.
@property(nonatomic, copy) NSArray *viewControllers
方法:setViewControllers:animated:
Replaces the view controllers currently managed by the navigation controller with the specified items.
- (void)setViewControllers:(NSArray *)viewControllers
animated:(BOOL)animated
Pushing and Popping Stack Items
方法:pushViewController:animated:
Pushes a view controller onto the receiver’s stack and updates the display.
- (void)pushViewController:(UIViewController *)viewController
animated:(BOOL)animated
參數:viewController、animated
方法:popViewControllerAnimated:
Pops the top view controller from the navigation stack and updates the display.
- (UIViewController *)popViewControllerAnimated:(BOOL)animated
參數:animated
方法:popToRootViewControllerAnimated:
Pops all the view controllers on the stack except the root view controller and updates the display.
- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated
參數:animated
方法:popToViewController:animated:
Pops view controllers until the specified view controller is at the top of the navigation stack.
- (NSArray *)popToViewController:(UIViewController *)viewController
animated:(BOOL)animated
參數:viewController、animated
屬性:interactivePopGestureRecognizer
The gesture recognizer responsible for popping the top view controller off the navigation stack. (read-only)
@property(nonatomic, readonly) UIGestureRecognizer *interactivePopGestureRecognizer
Configuring Navigation Bars
屬性:navigationBar
The navigation bar managed by the navigation controller. (read-only)
@property(nonatomic, readonly) UINavigationBar *navigationBar
方法:-setNavigationBarHidden:animated:
Sets whether the navigation bar is hidden.
- (void)setNavigationBarHidden:(BOOL)hidden
animated:(BOOL)animated
Hiding the Navigation Bar
屬性:hidesBarsOnTop
屬性: hidesBarsOnSwipe
屬性:hidesBarsWhenVerticallyCompact
屬性:hidesBarsWhenKeboardAppears
屬性:navigationBarHidden
屬性:barHideOnTapGestureRecognzier
屬性:barHideOnSwipeGestureRecognizer
附言:
Use this initialization method if you want to use custom navigation bar or toolbar subclasses with the navigation controller. If you use this method, you are responsible for adding a root view controller before presenting the navigation controller onscreen.