2010-03-27 56 views
0

如何檢測當您在UIImageView上滑動手指?例如說你滑過你的手指,它會改變顏色或其他東西。我希望能夠滑過多個UIImageView併發生某些事情...滑動手指UIImageView

回答

0

嘗試使用UIScrollView內的UIImageView

要檢測您在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 
{ 
}