zoukankan      html  css  js  c++  java
  • ios7禁止默认划动返回

     self.navigationController.interactivePopGestureRecognizer.enabled = NO;

    在使用之前先要判断是否ios7,不然会导致crash。然后创建一个自己的navigationController继承UINavigationController。之后还要设置UINavigationControllerDelegate,这样以上的方法才能触发。最后就判断要show出来的viewController是否需要支持划动返回了。

     - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated

    {
        if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
            if (viewController.class == [MyViewController class])
            {
                self.interactivePopGestureRecognizer.enabled = NO;
            } else {
                self.interactivePopGestureRecognizer.enabled = YES;
            }
        }
    }
  • 相关阅读:
    P2764 最小路径覆盖问题
    P1402 酒店之王 网络流
    P2597 [ZJOI2012]灾难 拓扑排序
    FJOI2017 矩阵填数
    2019.2.27模拟
    2019.2.26模拟
    SDOI2013 方程
    [AH2017/HNOI2017]抛硬币
    Lucas定理和扩展Lucas定理
    LuoguP4861 按钮
  • 原文地址:https://www.cnblogs.com/yangmx/p/3834011.html
Copyright © 2011-2022 走看看