最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

iOS動畫-定時對UIView進(jìn)行翻轉(zhuǎn)和抖動的方法

 更新時間:2017年04月23日 10:33:17   投稿:jingxian  
下面小編就為大家?guī)硪黄猧OS動畫-定時對UIView進(jìn)行翻轉(zhuǎn)和抖動的方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

(翻轉(zhuǎn))方式一:

[NSTimer scheduledTimerWithTimeInterval:3.f repeats:YES block:^(NSTimer * _Nonnull timer) {
      CABasicAnimation* rotationAnimation = [CABasicAnimation animation];;
      rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
      rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 ];
      rotationAnimation.duration = 1;
      // 切換界面保證動畫不停止
      rotationAnimation.removedOnCompletion = NO;
      rotationAnimation.repeatCount = 1;
      [self.bindCardImageView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
    }];

(翻轉(zhuǎn))方式二(這種方式較好一些):

CABasicAnimation *waitAnimation = [CABasicAnimation animation];
    waitAnimation.toValue = [NSNumber numberWithFloat:1.0];
    waitAnimation.duration = 3.f;
    waitAnimation.beginTime = 3.f;

    CABasicAnimation* rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
    rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 ];
    rotationAnimation.duration = 1.f;

    CAAnimationGroup *group = [CAAnimationGroup animation];
    group.duration = 4.f;
    group.repeatCount = CGFLOAT_MAX;
    group.removedOnCompletion = NO;

    [group setAnimations:@[waitAnimation, rotationAnimation]];

    [self.bindCardImageView.layer addAnimation:group forKey:@"bindCardImageViewAnimation"];

抖動:

CABasicAnimation* shake = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
  //設(shè)置抖動幅度
  shake.fromValue = [NSNumber numberWithFloat:-0.2];
  shake.toValue = [NSNumber numberWithFloat:+0.2];
  shake.duration = 0.1;
  shake.autoreverses = YES; //是否重復(fù)
  shake.repeatCount = 3;

  [itemView.iconImageView.layer addAnimation:shake forKey:@"imageView"];

以上這篇iOS動畫-定時對UIView進(jìn)行翻轉(zhuǎn)和抖動的方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Objective-C中NSNumber與NSDictionary的用法簡介

    Objective-C中NSNumber與NSDictionary的用法簡介

    這篇文章主要介紹了Objective-C中NSNumber與NSDictionary的用法簡介,雖然Objective-C即將不再是iOS的主流開發(fā)語言...well,需要的朋友可以參考下
    2015-09-09
  • iOS自定義鍵盤切換效果

    iOS自定義鍵盤切換效果

    這篇文章主要為大家詳細(xì)介紹了iOS自定義鍵盤切換效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2016-04-04
  • iOS中的AutoLayout使用實踐總結(jié)

    iOS中的AutoLayout使用實踐總結(jié)

    在對界面進(jìn)行布局的時候,我們經(jīng)常使用AutoLayout對界面進(jìn)行布局適配。下面這篇文章主要給大家介紹了iOS中AutoLayout使用實踐的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),需要的朋友可以參考借鑒,下面來一起看看吧。
    2017-12-12
  • iOS AVPlayer切換播放源實現(xiàn)連續(xù)播放和全屏切換的方法

    iOS AVPlayer切換播放源實現(xiàn)連續(xù)播放和全屏切換的方法

    這篇文章主要給大家介紹了關(guān)于iOS中AVPlayer切換播放源實現(xiàn)連續(xù)播放和全屏切換的方法,文中給出了詳細(xì)的示例代碼供大家參考學(xué)習(xí),對大家具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起看看吧。
    2017-05-05
  • 最新評論

    类乌齐县| 稻城县| 新化县| 莱西市| 合江县| 抚顺县| 阳山县| 安徽省| 大丰市| 夏河县| 台安县| 灵山县| 玉树县| 阜南县| 吴忠市| 潼关县| 绥阳县| 阿合奇县| 新绛县| 涟水县| 绩溪县| 延寿县| 天津市| 西和县| 榆社县| 鄂伦春自治旗| 峨边| 东莞市| 仙居县| 台湾省| 安溪县| 水城县| 当涂县| 牟定县| 富锦市| 田阳县| 长岭县| 兴宁市| 富裕县| 来宾市| 孝义市|