Commit 7ece66af9c23af68c8810844240bc5361f51b020
1 parent
4875ad92
0.6.7 版本 添加家园共享
Showing
3 changed files
with
44 additions
and
8 deletions
CNLiveNewIMAManagerKit.podspec
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | Pod::Spec.new do |s| | 9 | Pod::Spec.new do |s| |
| 10 | s.name = 'CNLiveNewIMAManagerKit' | 10 | s.name = 'CNLiveNewIMAManagerKit' |
| 11 | - s.version = '0.6.5' | 11 | + s.version = '0.6.7' |
| 12 | s.summary = 'A short description of CNLiveNewIMAManagerKit.' | 12 | s.summary = 'A short description of CNLiveNewIMAManagerKit.' |
| 13 | 13 | ||
| 14 | #s.description = <<-DESC | 14 | #s.description = <<-DESC |
CNLiveNewIMAManagerKit/Classes/TIMCategory/IMAMsg+UITableViewCell.m
| @@ -299,11 +299,11 @@ static NSString *const kIMAMsgShowChatAttributedText = @"kIMAMsgShowChatAttribut | @@ -299,11 +299,11 @@ static NSString *const kIMAMsgShowChatAttributedText = @"kIMAMsgShowChatAttribut | ||
| 299 | return [[NSAttributedString alloc] initWithString:@""]; | 299 | return [[NSAttributedString alloc] initWithString:@""]; |
| 300 | 300 | ||
| 301 | } | 301 | } |
| 302 | - if ([self isMineMsg]) { | ||
| 303 | - [string addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0, string.length)]; | ||
| 304 | - } | ||
| 305 | - else | ||
| 306 | - [string addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0, string.length)]; | 302 | +// if ([self isMineMsg]) { |
| 303 | +// [string addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0, string.length)]; | ||
| 304 | +// } | ||
| 305 | +// else | ||
| 306 | +// [string addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0, string.length)]; | ||
| 307 | 307 | ||
| 308 | return string; | 308 | return string; |
| 309 | } | 309 | } |
CNLiveNewIMAManagerKit/Classes/TIMCategory/TIMElem+ShowAPIs.m
| @@ -884,7 +884,7 @@ | @@ -884,7 +884,7 @@ | ||
| 884 | break; | 884 | break; |
| 885 | case EIMAMSG_ShareGoodsToHome: | 885 | case EIMAMSG_ShareGoodsToHome: |
| 886 | { | 886 | { |
| 887 | - return CGSizeMake(width, (60 + 10) * RATIO); | 887 | + return CGSizeMake(width, [self shareGoodsMessageContentHeightWithMsg:packMsg] + 10*RATIO); |
| 888 | } | 888 | } |
| 889 | break; | 889 | break; |
| 890 | case EIMAMSG_ShareCoupon: | 890 | case EIMAMSG_ShareCoupon: |
| @@ -1229,7 +1229,43 @@ | @@ -1229,7 +1229,43 @@ | ||
| 1229 | return size.height+20; | 1229 | return size.height+20; |
| 1230 | 1230 | ||
| 1231 | } | 1231 | } |
| 1232 | - | 1232 | +///返回商品共享到家园的消息高度 |
| 1233 | +- (CGFloat)shareGoodsMessageContentHeightWithMsg:(IMAMsg *)packMsg | ||
| 1234 | +{ | ||
| 1235 | + NSDictionary *shareGoodsDic = packMsg.customMsgData[@"shareGoodsData"]; | ||
| 1236 | + | ||
| 1237 | + NSString *contentStr = [NSString stringWithFormat:@"“%@”将“%@”共享至“%@”中,点击查看",shareGoodsDic[@"userName"], shareGoodsDic[@"goodsName"], shareGoodsDic[@"showName"]]; | ||
| 1238 | + | ||
| 1239 | + NSMutableAttributedString *contentAtt = [[NSMutableAttributedString alloc] initWithString:contentStr]; | ||
| 1240 | + | ||
| 1241 | + [contentAtt addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14*RATIO] range:NSMakeRange(0, contentStr.length)]; | ||
| 1242 | + [contentAtt addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithHexString:@"#666666"] range:NSMakeRange(0, contentStr.length)]; | ||
| 1243 | + [contentAtt addAttribute:NSForegroundColorAttributeName value:[UIColor orangeColor] range:NSMakeRange(contentStr.length - 4, 4)]; | ||
| 1244 | + | ||
| 1245 | + //插入图片 | ||
| 1246 | + NSTextAttachment *attchment = [[NSTextAttachment alloc]init]; | ||
| 1247 | + attchment.bounds = CGRectMake(0, 0, 7, 9);//设置frame | ||
| 1248 | + attchment.image = [UIImage imageNamed:@"more_icon"];//设置图片 | ||
| 1249 | + NSAttributedString *imageString = [NSAttributedString attributedStringWithAttachment:(NSTextAttachment *)(attchment)]; | ||
| 1250 | + [contentAtt appendAttributedString:imageString]; | ||
| 1251 | + | ||
| 1252 | + //保存内容文本 | ||
| 1253 | + packMsg.showChatAttributedText = contentAtt; | ||
| 1254 | + | ||
| 1255 | + //获取高度 | ||
| 1256 | + CGSize attSize = [contentAtt boundingRectWithSize:CGSizeMake(kScreenWidth*0.6 - 30, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin context:nil].size; | ||
| 1257 | + //注*要向上取整!!!!!!! | ||
| 1258 | + NSInteger minH = 16; //最小高度 | ||
| 1259 | + attSize.width = ceil(attSize.width); | ||
| 1260 | + attSize.height = ceil(attSize.height); | ||
| 1261 | + if (attSize.height < minH) { | ||
| 1262 | + attSize.height = minH; | ||
| 1263 | + } | ||
| 1264 | + attSize = CGSizeMake(attSize.width, attSize.height + 5); | ||
| 1265 | + //设置内容的size | ||
| 1266 | + packMsg.showContentSizeInChat = attSize; | ||
| 1267 | + return attSize.height; | ||
| 1268 | +} | ||
| 1233 | /// 获取一段文本高度 | 1269 | /// 获取一段文本高度 |
| 1234 | /// @param content 文本内容 | 1270 | /// @param content 文本内容 |
| 1235 | /// @param lineSpacing 行间距 | 1271 | /// @param lineSpacing 行间距 |