iphone - How to Better Drag a UIButton? UIButton UIControlEventTouchUpInside Event Is Not Called -
my draggable button using these events 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 center of uibutton uitouch location. however, there cases when end button being hung (normally snaps grid after finger release) because uicontroleventtouchupinside
never called!
how? let's start dragging button , while holding make screenshot (power+home). when release button no events ever called (i.e. uicontroleventtouchupinside
). therefore, button stuck , not snapping grid in method exitdragging
any light how make sure exitdragging
runs?
maybe easier using uiview apis touchesbegan
, touchesended
etc.
it seems anyway not using uibutton functionalities. think managing drag target mechanism of uibutton not intended for.
Comments
Post a Comment