zoukankan      html  css  js  c++  java
  • UINavigationController详解

     

    通过这个接口可以初始化自定义的工具栏和导航栏

    - (instancetype)initWithNavigationBarClass:(Class)navigationBarClass toolbarClass:(Class)toolbarClass NS_AVAILABLE_IOS(5_0)

     

    使用水平滑动过渡。如果视图控制器已在堆栈中在调用就没有效果

    - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated; 

     

    将栈顶的控制器弹出并返回这个弹出的控制器

    - (UIViewController *)popViewControllerAnimated:(BOOL)animated; // Returns the popped controller.

    弹出控制器直到指定的控制器在栈顶,返回弹出控制器的集合

    - (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated; // Pops view controllers until the one specified is on top. Returns the popped controllers.

    除了第一个控制器,其他全部弹出,返回弹出控制器的集合

    - (NSArray *)popToRootViewControllerAnimated:(BOOL)animated; // Pops until there's only a single view controller left on the stack. Returns the popped controllers.

     

    返回栈顶控制器

    @property(nonatomic,readonly,retain) UIViewController *topViewController; // The top view controller on the stack.

    返回模态视图控制器如果有的话,否则就是栈顶的控制器

    @property(nonatomic,readonly,retain) UIViewController *visibleViewController; // Return modal view controller if it exists. Otherwise the top view controller.

     

    当前导航控制器的视图控制器栈

    @property(nonatomic,copy) NSArray *viewControllers; // The current view controller stack.

    设置导航控制器的栈集合

    - (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated NS_AVAILABLE_IOS(3_0); // If animated is YES, then simulate a push or pop depending on whether the new top view controller was previously in the stack.

     

    显示/隐藏导航栏

    @property(nonatomic,getter=isNavigationBarHidden) BOOL navigationBarHidden;

     

    滑动返回手势

    @property(nonatomic, readonly) UIGestureRecognizer *interactivePopGestureRecognizer NS_AVAILABLE_IOS(7_0);

    据说在自定义了leftBarbuttonItem后左滑返回手势失效了怎么办?

    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]
                                             initWithImage:img
                                             style:UIBarButtonItemStylePlain
                                             target:self
                                             action:@selector(onBack:)];
    self.navigationController.interactivePopGestureRecognizer.delegate = (id<uigesturerecognizerdelegate>)self;
     
    同pushViewController:animated:相同

    - (void)showViewController:(UIViewController *)vc sender:(id)sender NS_AVAILABLE_IOS(8_0); // Interpreted as pushViewController:animated:

     

     

     

  • 相关阅读:
    白话SSL协议的握手过程
    PHP进程高负载
    Apache不定时宕机
    KindEditor
    过滤进程命令
    LAMP 平台必建安装包
    scp command
    ssl_request_log日志拆分
    Day01:Python入门
    Day03:集合、文件处理和函数基础
  • 原文地址:https://www.cnblogs.com/HypeCheng/p/4773062.html
Copyright © 2011-2022 走看看