广

IOS开发

  • IOS开发
  • android开发
  • PHP编程
  • JavaScript
  • ASP.NET
  • ASP编程
  • JSP编程
  • Java编程
  • 易语言
  • Ruby编程
  • Perl编程
  • AJAX
  • 正则表达式
  • C语言
  • 编程开发

    仿iOS图标抖动

    2018-04-03 22:30:14 次阅读 稿源:互联网
    零七广告

    仿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

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

    零七网部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与零七网进行文章共享合作。

    零七广告
    零七广告
    零七广告
    零七广告