This topic created in 4009 days ago, the information mentioned may be changed or developed.
事情起因是因为自定义了leftItem之后pop手势失效,然后重新对interactivePopGestureRecognizer的delegate进行重新赋值。
问题是当在topView的时候触发pop手势(沿着屏幕左边缘右滑),然后再进行push操作(比如说点击tableView某一行进入下一页),会出现push动画失效的情况,即UI还是在当前页,home键后重新进入恢复正常。
4 replies • 2015-07-20 11:53:36 +08:00
 |
|
1
kobe1941 Jul 20, 2015
在BaseViewController里开启或禁用
-(void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { if ([self.navigationController.viewControllers count] > 1) { self.navigationController.interactivePopGestureRecognizer.enabled = YES; self.navigationController.interactivePopGestureRecognizer.delegate = self; }else{
self.navigationController.interactivePopGestureRecognizer.enabled = NO; self.navigationController.interactivePopGestureRecognizer.delegate = nil; } } }
|
 |
|
2
Zrocky Jul 20, 2015
我是在自定义的NavigationController中写的 - (void)viewDidLoad { [super viewDidLoad]; self.delegate = self; self.popGestureDelegate = self.interactivePopGestureRecognizer.delegate; }
#pragma mark - UINavigationControllerDelegate
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated { if (viewController == self.viewControllers[0]) { self.interactivePopGestureRecognizer.delegate = self.popGestureDelegate; }else { self.interactivePopGestureRecognizer.delegate = nil; } }
|
 |
|
4
yfmir Jul 20, 2015
@ Zrocky 我之前也考虑过这种方案,但是对我这个项目不太可行 之前把delegate抽成单例了,以为是我自己少实现了什么方法,结果钻牛角尖了
|