How do you detect when you slide your finger across a UIImageView? Say for example you slide your finger across it and it changes color or something. I want to be able to slide across multiple UIImageViews and have somet开发者_JS百科hing happen...
Try a UIImageView
within a UIScrollView
!
To detect your touchs in a UIImageView
you have to rewrite a UIImageView
and set UserInteractionEnabled
to YES
. Then you can handle events like touchesBegan
and touchesEnded
.
UIImageWithTouchControl.h
@interface UIImageWithTouchControl : UIImageView
UIImageWithTouchControl.m
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
}
精彩评论