From d6a9e45bf775ce804ae47c3f50be2864ca0954bc Mon Sep 17 00:00:00 2001 From: giomfo Date: Thu, 16 Oct 2014 22:05:24 +0200 Subject: [PATCH] Room details: BugFix compute the actual height of table cell --- syMessaging/syMessaging/RoomViewController.m | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/syMessaging/syMessaging/RoomViewController.m b/syMessaging/syMessaging/RoomViewController.m index 6fad60503..dd90ad3c4 100644 --- a/syMessaging/syMessaging/RoomViewController.m +++ b/syMessaging/syMessaging/RoomViewController.m @@ -292,12 +292,11 @@ MXEvent *mxEvent = [messages objectAtIndex:indexPath.row]; // Use a TextView template to compute cell height - UITextView *textViewTemplate = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 200, 40)]; - textViewTemplate.scrollEnabled = NO; - textViewTemplate.autoresizingMask = UIViewAutoresizingFlexibleHeight; - textViewTemplate.text = [mxHandler displayTextFor:mxEvent inDetailMode:NO]; - [textViewTemplate sizeToFit]; - rowHeight = textViewTemplate.frame.size.height + (TEXT_VIEW_VERTICAL_MARGIN * 2); + UITextView *dummyTextView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 200, MAXFLOAT)]; + dummyTextView.font = [UIFont systemFontOfSize:14]; + dummyTextView.text = [mxHandler displayTextFor:mxEvent inDetailMode:NO]; + CGSize contentSize = [dummyTextView sizeThatFits:dummyTextView.frame.size]; + rowHeight = contentSize.height + (TEXT_VIEW_VERTICAL_MARGIN * 2); // Force minimum height: 50 if (rowHeight < 50) {