当前位置: 移动技术网 > IT编程>移动开发>IOS > 仿iOS图标抖动

仿iOS图标抖动

2019年07月24日  | 移动技术网IT编程  | 我要评论

马克思列宁主义揭示了,篮球之平凡王子,p50u20c

仿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

以上所述就是本文的全部内容了,希望大家能够喜欢。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网