You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.4 KiB

//
// XHMessageVoiceFactory.m
// MessageDisplayExample
//
// Created by HUAJIE-1 on 14-4-28.
// Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群142557668. All rights reserved.
//
#import "XHMessageVoiceFactory.h"
#import "myHelper.h"
@implementation XHMessageVoiceFactory
+ (UIImageView *)messageVoiceAnimationImageViewWithBubbleMessageType:(XHBubbleMessageType)type {
UIImageView *messageVoiceAniamtionImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 14, 17)];
NSString *imageSepatorName;
switch (type) {
case XHBubbleMessageTypeSending:
imageSepatorName = @"chat_发送语音";
break;
case XHBubbleMessageTypeReceiving:
imageSepatorName = @"chat_接收语音";
break;
default:
break;
}
NSMutableArray *images = [NSMutableArray arrayWithCapacity:4];
for (NSInteger i = 1; i < 4; i ++) {
UIImage *image = [myHelper getImageWithName:[imageSepatorName stringByAppendingFormat:@"%ld", (long)i]];
if (image)
[images addObject:image];
}
messageVoiceAniamtionImageView.image = [images lastObject];
messageVoiceAniamtionImageView.animationImages = images;
messageVoiceAniamtionImageView.animationDuration = 1.0;
[messageVoiceAniamtionImageView stopAnimating];
return messageVoiceAniamtionImageView;
}
@end