views:

346

answers:

1

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 something happen...

A: 

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
{
}
Tiago Ribeiro