iphone - Situation in which a hitTest-confirmed view with a gesture recognizer won't receive the event? -


`i've got view uiimageview subview. main view has single tap gesturerecognizer on works 99% of time.

every once in while, gesture recognizer seems fail, , event gets pushed stack next responder. i've added breakpoint in hittest method of top view, , hit test method correctly returns inner-most uiimageview in cases, including when event goes wrong place.

in situation view result of hittest not event passed gesture recognizer? i've printed out debug code hittest breakpoint when gesture selector doesn't called:

(lldb) po u $2 = 0x20854520 <uiimageview: 0x20854520; frame = (0 0; 61 62); opaque = no; layer = <calayer: 0x208e7670>>  (lldb) po [u superview] $0 = 0x1fd225e0 <hotspotview: 0x1fd225e0; frame = (303 663; 61 62); gesturerecognizers = <nsarray: 0x2082b850>; layer = <calayer: 0x1fd15af0>>  (lldb) po ((hotspotview *)u.superview).gesturerecognizers $1 = 0x208bc940 <__nsarrayi 0x208bc940>(     <uitapgesturerecognizer: 0x20828fa0; state = possible; cancelstouchesinview = no; delaystouchesended = no; view = <hotspotview 0x1fd225e0>; target= <(action=handlesingletap:, target=<hotspotview 0x1fd225e0>)>> ) 

u result of hit test (the uiimageview). u.superview container view has gesture recognizer attached it. so, here, confirm u.superview has gesture recognizer. shouldn't it, then, receive event? in situation event not make singletap , instead bubble next responder?

edit: i've managed capture problem again (xcode crashed last time had after few minutes...) , i've found touch makes way hotspotview. touchesbegan gets touch correctly if fails call gesture recognizer. i've logged touch , touch events both successful , unsuccessful taps (in terms of whether call gr or not) , appear identical.

so, i'm more lost.

1) right object returned hit test
2) right object receives touchesbegan call
3) object has gesture recognizer
4) , yet, sometimes, gesture recognizer not called (with no reliability , difficult reproduction).

my guess in situations gesture recognizer not recognize, gesture not qualifying tap. if accidentally tap twice in succession, example, or hold down long, or slide finger little, gesture might not seem single tap gesture recognizer.

in other words, keep in mind touch not gesture. doing nice logging shows structure is, , you've shown recent touch on uiimageview, not mean gesture recognizer recognized tap. there might other conflicting gesture recognizers, or gesture might not seem tap.

by way, doing odd thing here. hotspotview same size uiimageview. seems purpose detect tap. have done uiimageview alone. why not keep simple? set userinteractionenabled of uiimageview , attach tap gesture recognizer uiimageview itself.


Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -