UIImageView 小幅度震动动画

    [UIView beginAnimations:@"shake" context:nil];
    [UIView setAnimationDuration:0.1f];
    [UIView animateWithDuration:0.1f animations:^{

        //  一次动画开始时首先向左偏转
        _imageView.transform = CGAffineTransformMakeRotation(-0.05);

    } completion:^(BOOL finished) {

        [UIView animateWithDuration:0.1f delay:0 options:UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse | UIViewAnimationOptionAllowUserInteraction animations:^{

            //  一次动画结束时向右偏转,然后一直重复进行
            _imageView.transform = CGAffineTransformMakeRotation(0.05);

        } completion:^(BOOL finished) {

            //  动画完全结束时记得归位
            _imageView.transform = CGAffineTransformMakeRotation(0);

        }];
    }];
    [UIView commitAnimations];

 

posted on 2015-11-12 11:10  rgshio  阅读(241)  评论(0编辑  收藏  举报

导航