表情公屏显示
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#import "AccountInfoStorage.h"
|
||||
#import "XPMacro.h"
|
||||
#import "XPGiftStorage.h"
|
||||
#import "XPRoomFaceTool.h"
|
||||
///Model
|
||||
#import "XPMessageRemoteExtModel.h"
|
||||
#import "AttachmentModel.h"
|
||||
@@ -25,6 +26,8 @@
|
||||
#import "MicroStateModel.h"
|
||||
#import "RoomInfoModel.h"
|
||||
#import "DatingInfoModel.h"
|
||||
#import "RoomFaceInfoModel.h"
|
||||
#import "RoomFaceSendInfoModel.h"
|
||||
|
||||
#import "NetImageView.h"
|
||||
|
||||
@@ -79,7 +82,9 @@
|
||||
return [self createRoomDatingAttribute:attachment];
|
||||
} else if (first == CustomMessageType_Noble_VIP) {//贵族
|
||||
return [self createNobleLevelAttribute:attachment];
|
||||
}
|
||||
} else if (first == CustomMessageType_Face) {//贵族
|
||||
return [self createRoomFaceAttribute:attachment];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -176,6 +181,34 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - 表情显示
|
||||
- (NSAttributedString*)createRoomFaceAttribute:(AttachmentModel *)attachment {
|
||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||
if ([attachment.data[@"data"] isKindOfClass:[NSArray class]]) {
|
||||
NSArray * array = [RoomFaceSendInfoModel modelsWithArray:attachment.data[@"data"]];
|
||||
for (int i = 0; i< array.count; i++) {
|
||||
RoomFaceSendInfoModel * sendFaceInfo = [array objectAtIndex:i];
|
||||
[attribute appendAttributedString:[self createTextAttribute:sendFaceInfo.nick color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||
[attribute appendAttributedString:[self createTextAttribute:@":" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||
[attribute appendAttributedString:[self createTextAttribute:@"\n" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||
for (int j = 0; j < sendFaceInfo.resultIndexes.count; j++) {
|
||||
NSNumber *index = sendFaceInfo.resultIndexes[j];
|
||||
UIImage *face = [[XPRoomFaceTool shareFaceTool] findFaceImageById:sendFaceInfo.faceId index:[index integerValue]];
|
||||
if (face) {
|
||||
UIImageView *imageView = [[UIImageView alloc]init];
|
||||
imageView.image = face;
|
||||
imageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
imageView.bounds = CGRectMake(0, 0, 30, 30);
|
||||
NSMutableAttributedString * attrString = [NSMutableAttributedString yy_attachmentStringWithContent:imageView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(imageView.frame.size.width, imageView.frame.size.height) alignToFont:[UIFont systemFontOfSize:15.0] alignment:YYTextVerticalAlignmentCenter];
|
||||
[attribute appendAttributedString:[self createSapceAttribute:1]];
|
||||
[attribute appendAttributedString:attrString];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return attribute;
|
||||
}
|
||||
|
||||
#pragma mark - 收藏房间
|
||||
- (NSAttributedString*)createCollectRoomAttribute:(AttachmentModel *)attachment {
|
||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||
|
Reference in New Issue
Block a user