Reputation: 2438
I'm trying to create a custom cell with 4 UILabels
and a UITextView
. I've laid out the elements. The UITextView
is not scrollable. The problem I face it placing the last UILabel
under the UITextView
. I've tried pinning both(either) to the superview and nothing seems to work. It is always under the UITextView
no matter what as shown below:
What more should I do to move the UILabel below the UITextView?
This the only change I've made in my code:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
QXTInboxCell *inboxCell = (QXTInboxCell*)[self tableView:tableView cellForRowAtIndexPath:indexPath];
CGFloat width = self.tableView.frame.size.width - inboxCell.question.frame.origin.x - QUESTION_RIGHT_MARGIN;
CGSize size = [inboxCell.question sizeThatFits:CGSizeMake(width, 400)];
[inboxCell.question sizeThatFits:size];
return (inboxCell.question.frame.origin.y + size.height + 20);
}
Please help. I'm on XCode 5.0.2. Thanks.
Upvotes: 0
Views: 189
Reputation: 5520
Add the following constraints:
then (AFTER you set the text of the textView) call
[cell setNeedsLayout]
Of course this only works if you calculated the correct height for the cell in heightForRowAtIndexPath:
.
Upvotes: 2