Overridden to indicate that the receiver can prevent the specified gesture recognizer from recognizing its gesture.
SDKs
- iOS 3.2+
- Mac Catalyst 13.0+
- tvOS 9.0+
Framework
- UIKit
Declaration
func canPrevent(_ preventedGestureRecognizer: UIGesture Recognizer) -> Bool
Parameters
preventedGestureRecognizer
An instance of a subclass of
UIGesture
.Recognizer
Return Value
true
to indicate that the receiver can block prevented
from recognizing its gesture, otherwise false
.
Discussion
Overriding these methods enables the same behavior as implementing the UIGesture
methods gesture
and gesture
. However, by overriding them, subclasses can define class-wide prevention rules. For example, a UITap
object never prevents another UITap
object with a higher tap count.