12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- //
- // YOUPAILCMultiImageAttachment.m
- // LiveChat
- //
- // Created by 张灿 on 2018/9/22.
- // Copyright © 2018年 caicai. All rights reserved.
- //
- #import "YOUPAILCMultiImageAttachment.h"
- @implementation YOUPAILCMultiImageAttachment
- - (NSString *)encodeAttachment
- {
- NSDictionary *dict = @{
- CMType : @(CustomMultiImage),
- CMData : self.imageArray?self.imageArray:@[]
- };
- NSData *data = [NSJSONSerialization dataWithJSONObject:dict
- options:0
- error:nil];
- NSString *content = nil;
- if (data) {
- content = [[NSString alloc] initWithData:data
- encoding:NSUTF8StringEncoding];
- }
- return content;
- }
- - (NSString *)cellContent:(NIMMessage *)message{
- return @"YOUPAILCMultiImageContentView";
- }
- - (CGSize)contentSize:(NIMMessageModel *)model cellWidth:(CGFloat)width{
- if (self.imageArray.count>0) {
- return CGSizeMake(KScreenWidth-30, (KScreenWidth-30)*9/16+100*(self.imageArray.count-1));
- }else{
- return CGSizeMake(0, 0);
- }
- }
- - (UIEdgeInsets)contentViewInsets:(NIMMessage *)message
- {
- return UIEdgeInsetsZero;
- // CGFloat bubblePaddingForImage = 3.f;
- // CGFloat bubbleArrowWidthForImage = 5.f;
- // if (message.isOutgoingMsg) {
- // return UIEdgeInsetsMake(bubblePaddingForImage,bubblePaddingForImage,bubblePaddingForImage,bubblePaddingForImage + bubbleArrowWidthForImage);
- // }else{
- // return UIEdgeInsetsMake(bubblePaddingForImage,bubblePaddingForImage + bubbleArrowWidthForImage, bubblePaddingForImage,bubblePaddingForImage);
- // }
- }
- @end
|