zoukankan      html  css  js  c++  java
  • iOS 关于NavigationController返回的一些笔记

    1、理解NavigationController返回机制

    一般NavigationController下的子view只有一层或者有很多层,子view返回最顶层则可以直接用

    [self.navigationController popViewControllerAnimated:YES];

    如果NavigationController下有好几层子view,当前子view返回上一层,则可以用

    [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:([self.navigationController.viewControllers count] -2)] animated:YES];

    -3为上上一层,依此类推。push和pop的方法类似。

    2、手势右滑返回上一层

    控制器添加代理UIGestureRecognizerDelegate

    self.navigationController.interactivePopGestureRecognizer.delegate = self;
    
    - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{
        
        //判断是否是导航条的第一个子视图控制器
        if (self.navigationController && [self.navigationController.viewControllers count] >= 2) {
            return YES;
        }else{
            return NO;
        }
    }

     模态、导航栏混合模式

    https://www.cnblogs.com/dingding3w/p/6222626.html

  • 相关阅读:
    NYOJ135 取石子(二)
    NYOJ448 寻找最大数
    NYOJ20吝啬的国度
    NYOJ47过河问题
    NYOJ199无线网络覆盖
    NYOJ92图像有用区域
    NYOJ287Radar
    NYOJ71独木舟上的旅行
    NYOJ484The Famous Clock
    NYOJ148fibonacci数列(二)
  • 原文地址:https://www.cnblogs.com/sheer-code/p/10856923.html
Copyright © 2011-2022 走看看