gpt4 book ai didi

uitextview - 如何在 UITextView 上禁用 UITextTapRecognizer

转载 作者:行者123 更新时间:2023-12-04 01:39:10 30 4
gpt4 key购买 nike

我想尝试禁用 UITextTapRecognizer,我认为它是 UITextView 的内置属性,因为我怀疑它会干扰我想要实现的点击手势识别器。这怎么可能?

感谢阅读!

最佳答案

我不确定这是否直接回答了您的问题(即“禁用 UITextTapRecognizer”),但我认为它可能会有所帮助。您可以阻止 tapRecognizer 识别手势,从而基本上“禁用”它(我认为)。

"You can prevent gesture recognizers from looking at specific touches or from even recognizing a gesture. You can specify these “prevention” relationships using either delegation methods or overriding methods declared by the UIGestureRecognizer class.

The UIGestureRecognizerDelegate protocol declares two optional methods that prevent specific gesture recognizers from recognizing gestures on a case-by-case basis."

尝试 gestureRecognizerShouldBegin:gestureRecognizer:shouldReceiveTouch: 委托(delegate)协议(protocol)方法。

"In addition, there are two UIGestureRecognizer methods (declared in UIGestureRecognizerSubclass.h) that effect the same behavior as these delegation methods. A subclass can override these methods to define class-wide prevention rules."

看:

- (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)preventedGestureRecognizer;
- (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)preventingGestureRecognizer;

来源:Apple docs (iOS 事件处理指南)

希望对您有所帮助!

关于uitextview - 如何在 UITextView 上禁用 UITextTapRecognizer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12304959/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com