仿iOS图标抖动详细教程介绍
来源:爱站网时间:2018-04-23编辑:网友分享
今天小编跟大家分享一下仿iOS图标抖动详细教程介绍,感兴趣的朋友跟小编一起来了解一下吧!
今天小编跟大家分享一下仿iOS图标抖动详细教程介绍,感兴趣的朋友跟小编一起来了解一下吧!
#import "LHViewController.h" #define angelToRandian(x) ((x)/180.0*M_PI) @interface LHViewController () @property (strong, nonatomic) IBOutlet UIImageView *imageView; @end @implementation LHViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. UILongPressGestureRecognizer* longPress=[[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longPress:)]; [self.imageView addGestureRecognizer:longPress]; } -(void)longPress:(UILongPressGestureRecognizer*)longPress { if (longPress.state==UIGestureRecognizerStateBegan) { CAKeyframeAnimation* anim=[CAKeyframeAnimation animation]; anim.keyPath=@"transform.rotation"; anim.values=@[@(angelToRandian(-7)),@(angelToRandian(7)),@(angelToRandian(-7))]; anim.repeatCount=MAXFLOAT; anim.duration=0.2; [self.imageView.layer addAnimation:anim forKey:nil]; self.btn.hidden=NO; } } - (IBAction)delete:(id)sender { [self.imageView removeFromSuperview]; [self.btn removeFromSuperview]; } @end
以上就是仿iOS图标抖动详细教程的介绍,希望小编整理的相关知识和资料都对你们有所帮助,更多内容请继续关注爱站技术频道网站!
下一篇:IOS改变键盘颜色代码介绍