我试图让我UITableViewCell
根据textview
它的文本动态调整大小。但是我不能让他们一起工作。以下是我到目前为止所拥有的?现在单元格高度是正确的,但textView
没有根据contentSize.height
.
- (void)viewDidLoad
{
[super viewDidLoad];
// Set the label properties!
self.titleLabel.text = self.releaseTitle;
self.pubDateLabel.text = self.pubDate;
self.attachmentsLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)self.attatchments.count];
self.contentTextView.text = self.summary;
}
- (void)viewWillAppear:(BOOL)animated
{
}
- (void)viewDidAppear:(BOOL)animated
{
[self.tableView reloadData];
// Set the proper height of the content cell of the text
CGRect frame = self.contentTextView.frame;
frame.size.height = self.contentTextView.contentSize.height;
self.contentTextView.frame = frame;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return self.contentTextView.contentSize.height;
}