开发者

Sliding finger UIImageView

开发者 https://www.devze.com 2022-12-24 15:43 出处:网络
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 UIImageVi

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
{
}
0

精彩评论

暂无评论...
验证码 换一张
取 消