UITextView光标拖动(长按放大镜玻璃)不起作用

时间:2018-10-15 07:55:36

标签: ios objective-c

我有一个UITextView,在其中看不到长按文本放大镜。有没有办法强迫放大镜出现?

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {

    BOOL isAtLeastOneGestureInlineTextView = [self isInlineTextView:gestureRecognizer.view] || [self isInlineTextView:otherGestureRecognizer.view];
    if ((gestureRecognizer == [self longPressGesture]) && !isAtLeastOneGestureInlineTextView) {
        return NO;
    }

    if (gestureRecognizer == [self panGesture]) {
        return NO;
    }

    return YES;
}

- (BOOL)isInlineTextView:(UIView *)view {
    return [view isKindOfClass:[SFGInlineTextView class]];
}

显然有检查禁止长按。为了保留以前的实现,我已经检查了手势是否不是所需的textView