UIkit框架之uUInavigationController

1.继承链:UIviewcontroller:uiresponder:NSObject

2.如果你想使用一些动画转换,可以遵守 UINavigationControllerDelegate

3.创建导航控制器:

    (1)- (instancetype)initWithRootViewController:(UIViewController *)rootViewController  :使用系统默认的导航栏和工具栏,通过一个根视图创建导航控制器

    (2)- (instancetype)initWithNavigationBarClass:(Class)navigationBarClass
                              toolbarClass:(Class)toolbarClass  :通过一个自定义的导航栏和工具栏创建导航控制器

4.访问导航栈的item

    (1)@property(nonatomic, readonly, strong) UIViewController*topViewController  :返回栈顶的controller

    (2)@property(nonatomic, readonly, strong) UIViewController*visibleViewController  :返回显示的controller

    (3)@property(nonatomic, copy) NSArray<__kindof UIViewController *> *viewControllers  :返回堆栈中所有的controller

    (4)- (void)setViewControllers:(NSArray<UIViewController *> *)viewControllers
                  animated:(BOOL)animated  :设置管理的视图控制器

5.推出和压进栈item

    (1)- (void)pushViewController:(UIViewController *)viewController
                  animated:(BOOL)animated  :压入新的视图控制器

    (2)- (UIViewController *)popViewControllerAnimated:(BOOL)animated  :弹出一个视图控制器 返回的是栈顶的controller 

    (3)- (NSArray<__kindofUIViewController *> *)popToRootViewControllerAnimated:(BOOL)animated  :rootviewcontroller将会成为栈顶视图,返回所有的视图

    (4)- (NSArray<__kindofUIViewController *> *)popToViewController:(UIViewController *)viewController
                                                    animated:(BOOL)animated  :弹出到某个视图控制器 返回所有弹出的controller

    (5)@property(nonatomic, readonly) UIGestureRecognizer*interactivePopGestureRecognizer  :iOS7之后,在导航中右划会进行pop操作,设置这个的enable可以控制设置手势是否失效

6.配置导航条

    (1)@property(nonatomic, readonly) UINavigationBar*navigationBar  :导航栏对象,只读属性

    (2)- (void)setNavigationBarHidden:(BOOL)hidden
                      animated:(BOOL)animated  :设置隐藏导航栏

7.配置自定义的工具栏

    (1)@property(nonatomic, readonly) UIToolbar*toolbar  :获取工具栏对象

    (2)- (void)setToolbarHidden:(BOOL)hidden
                animated:(BOOL)animated  :隐藏工具栏

    (3)@property(nonatomic, getter=isToolbarHidden) BOOL toolbarHidden  :隐藏工具栏

8.隐藏导航条

    (1)@property(nonatomic, readwrite, assign) BOOL hidesBarsOnTap  :敲击屏幕可以隐藏与显示导航栏

    (2)@property(nonatomic, readwrite, assign) BOOL hidesBarsOnSwipe  :屏幕滑动的时候隐藏导航栏,常用于tableView,上滑隐藏导航栏,下滑显示,带动画效果

    (3)@property(nonatomic, readwrite, assign) BOOL hidesBarsWhenVerticallyCompact  :横屏的时候隐藏导航栏

    (4)@property(nonatomic, readwrite, assign) BOOL hidesBarsWhenKeyboardAppears  :当键盘出现的时候隐藏导航条

    (5)@property(nonatomic, getter=isNavigationBarHidden) BOOL navigationBarHidden  :隐藏导航条

    (6)@property(nonatomic, readonly, assign) UITapGestureRecognizer*barHideOnTapGestureRecognizer  :获取敲击屏幕的手势

    (7)@property(nonatomic, readonly, strong) UIPanGestureRecognizer*barHideOnSwipeGestureRecognizer  :获取滑动屏幕的手势

    (8)@property(nonatomic, weak) id< UINavigationControllerDelegate> delegate  :设置委托

9.显示viewcontroller的动作方法

    (1)- (void)showViewController:(UIViewController *)vc
                    sender:(id)sender  :这个方法是为了iOS方法的命名统一,在导航中,其作用和push一样

上一篇:mongo连接拒绝10061原因


下一篇:mysql 字段属性 与 排序