문제

I need to detect long-press on a UITextView, which already recognises long-press thus it has a long press recognizer, can I create a new one and add to it? How will it work then, two recognizers will get the same callback when you long-press?

Thanks!

도움이 되었습니까?

해결책

Just add two UILongPressRecognizers with different selectors (initWithTarget:selector:) to the view. It should work just like you think it will work. You may need to return YES from your delegate's -gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: when both of your UILongPressRecognizers are invoked simultaneously.

Note that you will likely encounter problems with Apple's recognizer for popping up the magnifier loupe.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top