ios - Using UIControlEventTouchDragEnter to trigger a button's method... but doesn't work? -


i trying set button using uicontroleventtouchdragenter way trigger button's method. specifically, have button, , want button's method triggered if user presses finger outside of button, , drags finger bounds of button.

according apple, event, uicontroleventtouchdragenter, is: event finger dragged bounds of control.

however, can't button trigger. here code:

- (ibaction)touchdragenter:(uibutton *)sender {     _samlpe.image = [uiimage imagenamed:@"alternate_pic.png"]; } 

so, when touchinto button triggered, method change current image of _sample alternate image. if use touchupinside, image change alternate upon button click.

does know why isn't working, or have work-arounds? thanks!

the touchdragenter triggered when tap button, drag finger outside of bounds of button, , drag again bounds of button.

you might want make use of touchesmoved method in view controller class , detect button entered based on location of touch:

- (void)touchesmoved:(nsset *)touches withevent:(uievent *)event {     uitouch * touch = [[event alltouches] anyobject];     cgpoint touchlocation = [touch locationinview:touch.view];     nslog(@"%f - %f", touchlocation.x, touchlocation.y); } 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -