diff --git a/Classes/LinphoneUI/UIChatBubblePhotoCell.m b/Classes/LinphoneUI/UIChatBubblePhotoCell.m index e807560bd..d2f99565f 100644 --- a/Classes/LinphoneUI/UIChatBubblePhotoCell.m +++ b/Classes/LinphoneUI/UIChatBubblePhotoCell.m @@ -679,7 +679,7 @@ imagesw = sSize.width; max_imagesw = MAX(max_imagesw, imagesw); originy = max_imagesh+IMAGE_DEFAULT_MARGIN; - max_imagesh = sSize.height; + max_imagesh += sSize.height; originx = sSize.width; } else { max_imagesw = MAX(max_imagesw, imagesw); @@ -691,6 +691,9 @@ contentView.fileUrls = fileUrls; [_finalAssetView addSubview:contentView]; } + CGRect imgFrame = self.finalAssetView.frame; + imgFrame.size = CGSizeMake(max_imagesw, max_imagesh); + self.finalAssetView.frame = imgFrame; _finalImage.hidden = YES; } else { // Resizing Image view @@ -706,10 +709,8 @@ const char *utf8Text = linphone_chat_message_get_text_content(self.message); CGRect textFrame = self.messageText.frame; - if (_contentViews.count > 0) - textFrame.origin = CGPointMake(textFrame.origin.x, self.finalAssetView.frame.origin.y + self.finalAssetView.frame.size.height-10); - else if (_finalImage.image) - textFrame.origin = CGPointMake(textFrame.origin.x, self.finalAssetView.frame.origin.y + self.finalAssetView.frame.size.height); + if (_contentViews.count > 0 || _finalImage.image) + textFrame.origin = CGPointMake(textFrame.origin.x, self.finalAssetView.frame.origin.y + self.finalAssetView.frame.size.height); else // When image hasn't be download textFrame.origin = CGPointMake(textFrame.origin.x, _imageSubView.frame.size.height + _imageSubView.frame.origin.y - 10); diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.m b/Classes/LinphoneUI/UIChatBubbleTextCell.m index db4c78928..47e41ae2f 100644 --- a/Classes/LinphoneUI/UIChatBubbleTextCell.m +++ b/Classes/LinphoneUI/UIChatBubbleTextCell.m @@ -499,7 +499,7 @@ static const CGFloat CELL_MESSAGE_Y_MARGIN = 44; if (imagesw > width) { imagesw = sSize.width; max_imagesw = MAX(max_imagesw, imagesw); - max_imagesh = imagesh; + max_imagesh += imagesh; imagesh = sSize.height; } else { max_imagesw = MAX(max_imagesw, imagesw); @@ -507,22 +507,21 @@ static const CGFloat CELL_MESSAGE_Y_MARGIN = 44; } } } - max_imagesh += imagesh; + size = CGSizeMake(max_imagesw, max_imagesh); CGSize textSize = CGSizeMake(0, 0); if (![messageText isEqualToString:@"🗻"]) { textSize = [self computeBoundingBox:messageText - size:CGSizeMake(width - CELL_MESSAGE_X_MARGIN - 4, CGFLOAT_MAX) + size:CGSizeMake(max_imagesw , CGFLOAT_MAX) font:messageFont]; - size.height += textSize.height; } // add size for message text size.height += textSize.height; size.width = MAX(textSize.width, size.width); size.width = MAX(size.width + CELL_MESSAGE_X_MARGIN, CELL_MIN_WIDTH); - size.height = MAX(size.height + CELL_MESSAGE_Y_MARGIN, CELL_MIN_HEIGHT); + size.height = MAX(size.height + CELL_MESSAGE_Y_MARGIN, CELL_MIN_HEIGHT) ; return size; }