在cellForRowAtIndexPath
创建cell
时,我还将UIPanGestureRecognizer
添加到cell
,并根据要求实施所有处理。
此Tableview
包含在myViewController
中的UINavigationController
中。
使用UIPanGestureRecognizer
UINavigationController
向后滑动无效。
当用户开始从手机的最左侧滑动时,如果执行UINavigationController swipe to back
而不是我的手机平移手势,我该怎么做呢。
-(void)move:(PanGestureRecognizer *)gesture {
CGPoint location = [gesture locationInView:self];
NSIndexPath *swipedIndexPath = [self indexPathForRowAtPoint:location];
TableViewCell *swipedCell = [self cellForRowAtIndexPath:swipedIndexPath];
CGRect cellRect = swipedCell.frame;
if(location.x < 75) {
?????
}
.
.
.
//my pan gesture required functionality
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
}
答案 0 :(得分:0)
使用requireGestureRecognizerToFail
。
在viewController中调用[yourPanGesture requireGestureRecognizerToFail:self.navigationController.interactivePopGestureRecognizer
或
[cell.gestureRecognizers enumerateObjectsUsingBlock:^(__kindof UIGestureRecognizer * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:[UIPanGestureRecognizer class]]) {
[obj requireGestureRecognizerToFail:interactivePopGestureRecognizer];
}
}];