How can i get a touch event of uiImage view?
i have a UIImageView named as myImageView. i need to set the userInteractionEnabled for this UIImageView. so i used myImageView.userInteractionEnabled = YES;
However still myImageView is not responding to any User interaction.
Can any one tell me 开发者_开发百科a good way to enable touch event on myImage View and also i need to get the myImageView image , when touch event is triggered.can any one help me please..
You need to provide an implementation for one or more of the touch events, such as touchesEnded:withEvent:
, in your view controller. The first parameter to that method is the set of touches that triggered the event. You can get more details in the documentation.
You could use a custom UIButton instead UIImageView of an and set its image to the image you want to display in the UIImageView. Then you can add an action to it.
UITouch *touch = [touches anyObject];
CGPoint currentPoint = [touch locationInView:drawImage];
Where drawImage is your ImageView
精彩评论