テキストに基づいて動的にUITableViewCell
サイズ変更される a に基づいて適切にサイズ変更しようとしています。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;
}