滑动手指UIImageView

时间:2010-03-27 04:44:20

标签: iphone sdk uiimageview touch swipe

如何检测何时在UIImageView上滑动手指?比方说,你用手指滑过它,它会改变颜色或其他东西。我希望能够跨越多个UIImageViews并发生一些事情......

1 个答案:

答案 0 :(得分:0)

UIImageView内尝试UIScrollView

要在UIImageView中检测您的触摸,您必须重写UIImageView并将UserInteractionEnabled设置为YES。然后,您可以处理touchesBegantouchesEnded等事件。

<强> UIImageWithTouchControl.h

@interface UIImageWithTouchControl : UIImageView

<强> UIImageWithTouchControl.m

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
}

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
}