·您现在的位置: 江北区云翼计算机软件开发服务部 >> 文章中心 >> 网站建设 >> app软件开发 >> IOS开发 >> IOS学习笔记-UINavgationController

IOS学习笔记-UINavgationController

作者:佚名      IOS开发编辑:admin      更新时间:2022-07-23

Creating Navigation Controllers

UINavgationController继承关系图

 

方法:initWithRootViewController:

Initializes and returns a newly created navigation controller.

- (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.