CABasicAnimation *shake = [CABasicAnimation animationWithKeyPath:@"transform.translation.x"];

    shake.fromValue = [NSNumber numberWithFloat:-5];

    shake.toValue = [NSNumber numberWithFloat:5];

    //执行时间

    shake.duration = 0.1;

    //是否重复

    shake.autoreverses = YES;

    //次数

    shake.repeatCount = 2;

    [self.label.layer addAnimation:shake forKey:@"shakeAnimation"];

    self.label.alpha = 1.0;

    [UIView animateWithDuration:2.0 delay:0.0 options:UIViewAnimationOptionCurveEaseIn | UIViewAnimationOptionAllowUserInteraction animations:^{

        //self.label.alpha = 0.0; //透明度变0则消失

 

    } completion:nil];

posted on 2015-04-07 15:58  ABCDEFGHIJKLMN  阅读(164)  评论(0编辑  收藏  举报