My draggable button is using these events to be dragged:
[button addTarget:self action:@selector(beganDragging:)
forControlEvents:UIControlEventTouchDown];
[button addTarget:self action:@selector(wasDragged:withEvent:)
forControlEvents:UIControlEventTouchDragOutside | UIControlEventTouchDragInside];
[button addTarget:self action:@selector(exitDragging:)
forControlEvents:UIControlEventTouchUpInside];
It's straight forward above. Method wasDragged
adjusts the center of the UIButton to the UITouch location. However, there are cases when I end up with button being hung (normally it snaps to grid after finger release) because UIControlEventTouchUpInside
is never called!
How? Let's say I start dragging a button and while holding it I make a screenshot (Power+Home). When I release the button no events are ever called (i.e. UIControlEventTouchUpInside
). Therefore, my button is stuck and not snapping to grid which is in method exitDragging
Any light how to make sure exitDragging
always runs?