How to prevent two UIButton clicked simultaneously in iOS?

Kuang Lin
1 min readAug 23, 2019

--

shortest answer ever.

All you need to do is call:

UIView.appearance().isExclusiveTouch = true

in the beginning of the app.

According to Doc:

Discussion

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.

And when we use UIView.appearance() , we get all the view being set to this property value.

For appearance, note that:

You can customize the appearance of instances of a class by sending appearance modification messages to the class’s appearance proxy.

--

--

Kuang Lin
Kuang Lin

No responses yet