Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要检测 UITextView 上的长按,它已经识别长按,因此它有一个长按识别器,我可以创建一个新的并添加到它吗?那么它将如何工作,当您长按时,两个识别器将获得相同的回调?
谢谢!
只需在视图中添加两个UILongPressRecognizer具有不同选择器 ( initWithTarget:selector:) 的 s。它应该像您认为的那样工作。当您的两个同时被调用时,您可能需要YES从您的代表返回。-gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:UILongPressRecognizers
UILongPressRecognizer
initWithTarget:selector:
YES
-gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:
UILongPressRecognizers
请注意,您可能会遇到 Apple 识别器弹出放大镜的问题。