2020-04-16 测滑返回

2020-04-16  本文已影响0人  开创Me世界

最近接手一个项目,发现好多基础的知识都忘掉了,就比如标题上写的 测滑返回,就卡在这儿了,这不上来记录下:

回忆中隐约记得,在info 文件还是哪里可以设置下,项目APP是否启用 系统的测滑返回这个效果,现在是找不到了,望路过的大神有知道的指点下

我这里只记载UINavigationController测滑返回,使用简单方便

创建个Base_NavigationController 然后继承UINavigationController 

遵守协议<UINavigationControllerDelegate,UIGestureRecognizerDelegate>

定义@property (nonatomic,strong) id popDelegate; 属性

然后赋值

self.popDelegate = self.interactivePopGestureRecognizer.delegate;

    self.delegate=self;

最后实现方法

#pragma UINavigationControllerDelegate方法

- (void)navigationController:(UINavigationController*)navigationControllerdidShowViewController:(UIViewController*)viewControlleranimated:(BOOL)animated

{

    //实现滑动返回功能

    //清空滑动返回手势的代理就能实现

    self.interactivePopGestureRecognizer.delegate=  viewController ==self.viewControllers[0]? self.popDelegate : nil;

}

这样的话就完美实现测滑返回了,不喜,就狂喷吧👏👏👏,欢迎留言骚扰

上一篇 下一篇

猜你喜欢

热点阅读