在iOS7中,我们有一个新的“从左向右滑动”的手势,这是一个非常有用的功能,但我现在遇到一个问题。
我使用这段代码自定义
我使用这段代码自定义
UINavigationBar
中的返回按钮:
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:view];
但这会禁用“从左向右滑动”的手势,所以我使用以下代码来保持手势启用:
self.navigationController.interactivePopGestureRecognizer.delegate = self
然后,我发现手势工作异常,如果当前的ViewController有一个tableView,在tableView滚动时,手势无法被触发。现在手势不能很容易地被触发,是否有一些方法来解决它?
(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
,return YES;
以禁用 otherGestureRecognizer,这样当前的 ViewController 就不会收到UIPanGestureRecognizer
用于滚动UITableView
。现在看起来很好,非常感谢! - Wei