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:

     

     

     

  • 相关阅读:
    小记:xml画一个爱心。
    类似UC天气下拉和微信下拉眼睛头部弹入淡出UI交互效果(开源项目)。
    FloatingActionButton增强版,一个按钮跳出多个按钮--第三方开源--FloatingActionButton
    回调机制的实现。
    小记:使用SharedPreferences存储来设置程序第一次进入欢迎界面,以后不会再进入欢迎界面。
    小记:获取系统时间的long值,格式化成可读时间。
    写程序的欢迎界面(运用画图方法画圆球)。
    并发的HashMap为什么会引起死循环?
    zuul重试配置
    zuul超时问题
  • 原文地址:https://www.cnblogs.com/HypeCheng/p/4773062.html
Copyright © 2011-2022 走看看