IOS动画iOS Developer

iOS中微信语音动画

2016-04-01  本文已影响3012人  Hither

做项目的遇到这样一个需求,模仿微信的语音消息,点击以后有波纹扩散效果。

代码很简单 几句话就可以搞定,下面是代码:

UIImageView *voice = [[UIImageView alloc]initWithFrame:CGRectMake(40, 22.5, 15, 15)];
//动画未开始前的图片
voice.image = [UIImage imageNamed:@"chat_animation_white3"];
//进行动画效果的3张图片(按照播放顺序放置)
        voice.animationImages = [NSArray arrayWithObjects:
                                      [UIImage imageNamed:@"chat_animation_white1"],
                                      [UIImage imageNamed:@"chat_animation_white2"],
                                      [UIImage imageNamed:@"chat_animation_white3"],nil];
//设置动画间隔
        voice.animationDuration = 1;
        voice.animationRepeatCount = 0;
        voice.userInteractionEnabled = NO;
        voice.backgroundColor = [UIColor clearColor];
        
        [self.view addSubview:voice];
上一篇 下一篇

猜你喜欢

热点阅读