2012-08-30 60 views
3

我現在想通過這個代碼我在同一地點每次「漣漪效應」的UIImageView

CATransition *animation = [CATransition animation]; 
[animation setDelegate:self]; 
[animation setDuration:2.0f]; 
[animation setTimingFunction:UIViewAnimationCurveEaseInOut]; 
[animation setType:@"rippleEffect" ]; 
[imgView.layer addAnimation:animation forKey:NULL]; 

讓動畫製作漣漪動畫與下面的代碼,但我想觸摸點動畫上的ImageView 平均動畫將發生在用戶將點擊UIImageView

回答

3

我覺得下面的代碼可以幫助你。

[UIView beginAnimations:nil context:NULL]; 
[UIView setAnimationDuration:1.0]; 
[UIView setAnimationTransition:(UIViewAnimationTransition) 110 forView:view cache:NO]; 
[UIView commitAnimations]; 

您還可以更好地訪問this後類似於您的帖子。

+0

我應用此代碼,但我不能得到動畫....我只是用「imgView」替換「視圖」。 – Vishal

+0

請同時訪問提到的[鏈接](http://stackoverflow.com/questions/5973530/iphone-having-a-ripple-effect-on-a-uiimageview) – BornCoder

+0

我訪問該鏈接,但我不能得到動畫... ..我可以從你的代碼中獲取動畫嗎? – Vishal