I\'m trying to make a UIImageView accept actions and fire them everytime it clicked on the UIImageVie, but i\'m having hard time in getting it to work, please help me out
UIImageView
is not a control, you can't add a target for control events to it. You have several options:
Place an invisible UIButton
over the UIImageView
and add your target to that. You can set the button's style to custom and its text (and image) to nothing to make it invisible.
Use just a UIButton
. You can add a background image to it.
Add a UITapGestureRecognizer
to your image view and implement it's touch handler method.
Subclass UIImageView
and override the touch handling methods to do what ever you need to do.