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.
41 lines
1.5 KiB
41 lines
1.5 KiB
// |
|
// XHMessageVoiceFactory.m |
|
// MessageDisplayExample |
|
// |
|
// Created by HUAJIE-1 on 14-4-28. |
|
// Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. |
|
// |
|
|
|
#import "XHMessageVoiceFactory.h" |
|
|
|
@implementation XHMessageVoiceFactory |
|
|
|
+ (UIImageView *)messageVoiceAnimationImageViewWithBubbleMessageType:(XHBubbleMessageType)type { |
|
UIImageView *messageVoiceAniamtionImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 14, 17)]; |
|
NSString *imageSepatorName; |
|
switch (type) { |
|
case XHBubbleMessageTypeSending: |
|
imageSepatorName = @"chatto_right_f"; |
|
break; |
|
case XHBubbleMessageTypeReceiving: |
|
imageSepatorName = @"chatto_left_f"; |
|
break; |
|
default: |
|
break; |
|
} |
|
NSMutableArray *images = [NSMutableArray arrayWithCapacity:4]; |
|
for (NSInteger i = 0; i < 4; i ++) { |
|
UIImage *image = [UIImage imageNamed:[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
|
|
|