I'm trying to implement touch event similar to a Touch Up Inside
a UIButton
. I've seen some codes using touchesBegan:withEvent
but it looks I need to slide a bit my finger over the screen. I actually just want to touch in the image
Code:
- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
NSLog(@"Image touched!");
}
Regards!
UIImageView
is notorious regarding this as itsuserInteractionEnabled
is set toNO
by default. You will have to enable it by doingAnd then you can use gesture recognizers or the normal
touches*
methods to handle touches.You could use the gesture to get the touch on
UIImageView
.Implement the
ClickEventOnImage
function.