Code Monkey home page Code Monkey logo

Comments (3)

userdefault avatar userdefault commented on May 19, 2024 2

全屏侧滑返回方法如下:
创建一个navigationcontroler继承RTRootNavigationController

@interface BaseNavigationController () <UIGestureRecognizerDelegate>

@end

@implementation BaseNavigationController
- (void)viewDidLoad {
  [super viewDidLoad];
  
  // 获取系统自带滑动手势的target对象
  id target = self.interactivePopGestureRecognizer.delegate;
  // 创建全屏滑动手势,调用系统自带滑动手势的target的action方法
  UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:target action:@selector(handleNavigationTransition:)];
  // 设置手势代理,拦截手势触发
  pan.delegate = self;
  // 给导航控制器的view添加全屏滑动手势
  [self.view addGestureRecognizer:pan];
  // 禁止使用系统自带的滑动手势
  self.interactivePopGestureRecognizer.enabled = NO;

}
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
  {
  // 注意:只有非根控制器才有滑动返回功能,根控制器没有。
  // 判断导航控制器是否只有一个子控制器,如果只有一个子控制器,肯定是根控制器
  if (self.childViewControllers.count == 1) {
      // 表示用户在根控制器界面,就不需要触发滑动手势,
      return NO;
  }
  return YES;
  }

from rtrootnavigationcontroller.

rickytan avatar rickytan commented on May 19, 2024

https://github.com/forkingdog/FDFullscreenPopGesture

from rtrootnavigationcontroller.

clearlovelyQ avatar clearlovelyQ commented on May 19, 2024

你好,我自定义了一个导航控制器继承自RTRootNavigationController ,在控制器里面加入了 @userdefault 的代码,确实是实现了全屏侧滑的功能,但是我发现,rt_disableInteractivePop = YES失效了,不能禁止某个vc的侧滑效果了,不知道是不是我自己设置的不对,大佬要是要时间的话,帮忙解答一下,万分感谢,版本iOS13.4.1 rt版本0.7

from rtrootnavigationcontroller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.