Home ios - uiview
Post
Cancel

ios - uiview

1
var isExclusiveTouch: Bool { get set }
1
2
3
A Boolean value that indicates whether the receiver handles touch events exclusively.

Setting this property to true causes the receiver to block the delivery of touch events to other views in the same window. The default value of this property is false.

stackOverflow Q&A

1
2
3
exclusiveTouch only prevents touches in other views during the time in which there's an active touch in the exclusive touch view. That is, if you put a finger down in an exclusive touch view touches won't start in other views until you lift the first finger. It does not prevent touches from starting in other views if there are currently no touches in the exclusiveTouch view.

To truly make this view the only thing on screen that can receive touches you'd need to either add another view over top of everything else to catch the rest of the touches, or subclass a view somewhere in your hierarchy (or your UIWindow itself) and override hitTest:withEvent: to always return your text view when it's visible, or to return nil for touches not in your text view.
This post is licensed under CC BY 4.0 by the author.