When you press a UIButton, if you keep holding it while dragging your finger outside of its bounds, there's a certain distance that you can move you finger until the button's state is not "highlighted" anymore.

Essentially, you can press a button, move your finger outside of it, release it, and the button will still fire, even though your finger wasn't on it when it was released.

Is there any way to prevent this behavior? I want buttons to be "released" as soon as you're outside of them.

1

There are 1 best solutions below

2
Amit On

The UIControlEvent you are looking for is UIControlEventTouchUpInside - It works when touch is inside of the bound.

For more details check this URL: