forked from mirrors/linphone-iphone
fix UIChatBubblePhotoCell view when image hasn't be downloaded
This commit is contained in:
parent
598d572d39
commit
1689c7530a
2 changed files with 30 additions and 22 deletions
|
|
@ -410,21 +410,25 @@
|
|||
imgFrame.size = [UIChatBubbleTextCell getMediaMessageSizefromOriginalSize:[_finalImage.image size] withWidth:chatTableView.tableView.frame.size.width - 40];
|
||||
imgFrame.origin.x = (bubbleFrame.size.width - imgFrame.size.width)/2;
|
||||
self.finalAssetView.frame = imgFrame;
|
||||
|
||||
// Positioning text message
|
||||
const char *utf8Text = linphone_chat_message_get_text_content(self.message);
|
||||
|
||||
CGRect textFrame = self.messageText.frame;
|
||||
textFrame.origin = CGPointMake(textFrame.origin.x, self.finalAssetView.frame.origin.y + self.finalAssetView.frame.size.height);
|
||||
if (!utf8Text) {
|
||||
textFrame.size.height = 0;
|
||||
} else {
|
||||
textFrame.size.height = bubbleFrame.size.height - textFrame.origin.x;
|
||||
}
|
||||
|
||||
self.messageText.frame = textFrame;
|
||||
LOGD([NSString stringWithFormat:@"Text of the photoCell: %@, size of the text of the photoCell: %@", [self.messageText text], NSStringFromCGSize(textFrame.size)]);
|
||||
}
|
||||
|
||||
// Positioning text message
|
||||
const char *utf8Text = linphone_chat_message_get_text_content(self.message);
|
||||
|
||||
CGRect textFrame = self.messageText.frame;
|
||||
if (_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, 42);
|
||||
if (!utf8Text) {
|
||||
textFrame.size.height = 0;
|
||||
} else {
|
||||
textFrame.size.height = bubbleFrame.size.height - 90;//textFrame.origin.x;
|
||||
}
|
||||
|
||||
self.messageText.frame = textFrame;
|
||||
LOGD([NSString stringWithFormat:@"Text of the photoCell: %@, size of the text of the photoCell: %@", [self.messageText text], NSStringFromCGSize(textFrame.size)]);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -416,9 +416,17 @@ static const CGFloat CELL_MESSAGE_Y_MARGIN = 52; // 44;
|
|||
CGSize fileSize = CGSizeMake(200, 80);
|
||||
size = [self getMediaMessageSizefromOriginalSize:fileSize withWidth:width];
|
||||
} else {
|
||||
CGSize textSize = CGSizeMake(0, 0);
|
||||
if (![messageText isEqualToString:@"🗻"]) {
|
||||
textSize = [self computeBoundingBox:messageText
|
||||
size:CGSizeMake(width - CELL_MESSAGE_X_MARGIN - 4, CGFLOAT_MAX)
|
||||
font:messageFont];
|
||||
size.height += textSize.height;
|
||||
}
|
||||
|
||||
if (!localImage && !localVideo) {
|
||||
//We are loading the image
|
||||
return CGSizeMake(CELL_MIN_WIDTH + CELL_MESSAGE_X_MARGIN, CELL_MIN_HEIGHT + CELL_MESSAGE_Y_MARGIN);
|
||||
return CGSizeMake(CELL_MIN_WIDTH + CELL_MESSAGE_X_MARGIN, CELL_MIN_HEIGHT + CELL_MESSAGE_Y_MARGIN + textSize.height);
|
||||
}
|
||||
PHFetchResult<PHAsset *> *assets;
|
||||
if(localImage)
|
||||
|
|
@ -435,13 +443,9 @@ static const CGFloat CELL_MESSAGE_Y_MARGIN = 52; // 44;
|
|||
size.height += 40;
|
||||
size.width -= CELL_MESSAGE_X_MARGIN;
|
||||
|
||||
if (![messageText isEqualToString:@"🗻"]) {
|
||||
CGSize textSize = [self computeBoundingBox:messageText
|
||||
size:CGSizeMake(width - CELL_MESSAGE_X_MARGIN - 4, CGFLOAT_MAX)
|
||||
font:messageFont];
|
||||
size.height += textSize.height;
|
||||
size.width = MAX(textSize.width, size.width);
|
||||
}
|
||||
// add size for message text
|
||||
size.height += textSize.height;
|
||||
size.width = MAX(textSize.width, size.width);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue