iPhone SDK:创建摆动效果

时间:2010-10-02 09:19:30

标签: iphone sdk ios4

  

可能重复:
  How do you create a wiggle animation similar to iphone deletion animation

其实这是一个答案!我为想要使用UIImageView

创建摆动效果的人制作了教程

Wiggle效果代码:

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.14];
[UIView setAnimationRepeatAutoreverses:YES];
[UIView setAnimationRepeatCount:10000];


myImage.transform = CGAffineTransformMakeRotation(69);
myImage.transform = CGAffineTransformMakeRotation(-69);

[UIView commitAnimations];

停止动画,你可以使用这段代码:

myImage.transform = CGAffineTransformMakeRotation(0);

[myImage.layer removeAllAnimations]; 

//#import <QuartzCore/QuartzCore.h> to remove a compiler warning ;)
希望你喜欢它。

0 个答案:

没有答案