Commit d97770e80cde21718aa6257b3f6f1f9cbbf51376
1 parent
6fd5514b
0.1.23 版本,兼容安卓商家版发送表情消息
Showing
2 changed files
with
19 additions
and
1 deletions
CNLiveBusinessTools.podspec
CNLiveBusinessTools/Classes/CNLiveBusinessTools.m
| ... | ... | @@ -1081,6 +1081,24 @@ |
| 1081 | 1081 | [attStr replaceCharactersInRange:result.range withAttributedString:imageStr]; |
| 1082 | 1082 | NSLog(@"\n11111:text%@,range:%@",text,NSStringFromRange(result.range)); |
| 1083 | 1083 | } |
| 1084 | + else if([[text substringWithRange:result.range] cn_containsString:emojiArr[j].identifier]) | |
| 1085 | + { | |
| 1086 | + NSString *resultStr = [text substringWithRange:result.range]; | |
| 1087 | + resultStr = [resultStr stringByReplacingOccurrencesOfString:@"[" withString:@""]; | |
| 1088 | + resultStr = [resultStr stringByReplacingOccurrencesOfString:@"]" withString:@""]; | |
| 1089 | + if ([resultStr isEqualToString:emojiArr[j].identifier]) { | |
| 1090 | + | |
| 1091 | + CNEmojiTextAttachment *textAttachment = [[CNEmojiTextAttachment alloc]init]; | |
| 1092 | + textAttachment.image = emojiArr[j].image; | |
| 1093 | + textAttachment.bounds = CGRectMake(0, -4.7, 20*RATIO, 20*RATIO); | |
| 1094 | + textAttachment.emojiText = emojiArr[j].displayName; | |
| 1095 | + | |
| 1096 | + NSAttributedString *imageStr = [NSAttributedString attributedStringWithAttachment:textAttachment]; | |
| 1097 | + [attStr replaceCharactersInRange:result.range withAttributedString:imageStr]; | |
| 1098 | + NSLog(@"\n11111:text%@,range:%@",text,NSStringFromRange(result.range)); | |
| 1099 | + } | |
| 1100 | + | |
| 1101 | + } | |
| 1084 | 1102 | } |
| 1085 | 1103 | }else |
| 1086 | 1104 | {//目前只有 暂时没有判断是否是url办法 表情和url | ... | ... |