侧滑返回功能失效解决
2015-10-13 19:39
309 查看
自定义一个UINavigationController,实现几个代理方法
然后,将你的UINavigationController都替换成该自定的NavigationController就OK了
解决iOS7自定义返回按钮后不能侧滑返回的问题
标签:uinavigationcontroller pop 侧滑返回
@interface CustomNavigationController : UINavigationController @end
#import "CustomNavigationController.h" @interface CustomNavigationController ()<UINavigationControllerDelegate, UIGestureRecognizerDelegate> @property(nonatomic, weak) UIViewController *currentShowVC; @end @implementation CustomNavigationController - (instancetype)initWithRootViewController:(UIViewController *)rootViewController { CustomNavigationController *nav = [super initWithRootViewController:rootViewController]; nav.interactivePopGestureRecognizer.delegate = self; nav.delegate = self; return nav; } - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated { if (1 == navigationController.viewControllers.count) { self.currentShowVC = nil; } else { self.currentShowVC = viewController; } } - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { if (gestureRecognizer == self.interactivePopGestureRecognizer) { return (self.currentShowVC == self.topViewController); } return YES; } - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]] && [otherGestureRecognizer isKindOfClass:[UIScreenEdgePanGestureRecognizer class]]) { return YES; } else { return NO; } } @end
然后,将你的UINavigationController都替换成该自定的NavigationController就OK了
解决iOS7自定义返回按钮后不能侧滑返回的问题
标签:uinavigationcontroller pop 侧滑返回
相关文章推荐
- UIView与CALayer的理解
- 有关圆的计算。
- centos7 matlab install
- 坚持坚持坚持
- linux上应用程序的执行机制
- Rotate Array
- 杭电acm--1040
- tomcat Manger App
- struts2拦截器问题
- 【C++】指针&引用的区别
- Xsollad电竞学院为学生和教练打开大门啦!
- 【LeetCode】Binary Tree Level Order Traversal 解题报告
- ServletContext保存访问量
- Oracle-PlSQL程序设计
- iOS多线程编码之NSThread的使用
- Unity接口函数Vector3.Project()
- OpenCV - imwrite函数的使用
- Maven编译时跳过Test
- IOS之swift第一课基础代码
- Use of UUID(Universally unique identifier) in Ruby On Rails Application.