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开发原生定位

2019-12-31 14:14:54

iOS文章

Failed to load Info.plist from bundle at path XXX

2019-12-31 15:02:32

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
有新消息 消息中心
搜索