iOS: inconsistent behaviour with UIButton's UIControlEventTouchUpOutside event -
i want dual functionality uibutton.
when user touches down on button, want trigger behaviour a
but if user drags finger outside of button before releasing it, trigger behaviour b upon release.
so,
[presetbutton addtarget: self action: @selector( presetbuttonhit: ) forcontrolevents: uicontroleventtouchdown ]; [presetbutton addtarget: self action: @selector( presetbuttonswipe: ) forcontrolevents: uicontroleventtouchupoutside ];
as test case log 'a' or 'b' respective action methods.
a gets hit correctly.
however, b sporadic. can methodically finger down, drag outside of button, wait second , release. , wont' fire. alternatively if quick flick, more fire. still 50-50.
all have uiview background image , 6 buttons.
what can track 1 down?
i rather bottom of mess around manually tracking touches , down; if have that, there clean way? can see going royal pita, , i'm going have figure out whether touches up/down gets hit before button's touch up/down gets hit, set flags, etc.
this duplicate of strange uibutton behavior: normal? recommend keeping because question title worded.
when finger goes down on button, image darkens
as drag finger away, moment pass invisible circumference clear centimetre , more beyond button's frame, image returns original colour
this typical behaviour ' cancelling touch moving finger far enough away before releasing '
if release finger inside zone, going fire touch inside. sim outside.
looks though apple didn't anticipate using these methods getting dual functionality uibutton.
now, there simple way catch xy touch coordinates within action. action receives id of button pressed.
but here elegant way:
http://sree.cc/iphone/handling-touche-events-for-uibuttons-in-iphone
uicontrol has methods detecting drag start / move / stop. can override these , screen coordinates.
Comments
Post a Comment