开发者

How Can I Set the Height of a Single UITabelViewCell to a Constant Value?

开发者 https://www.devze.com 2023-01-24 08:13 出处:网络
I am searching on Google about this but I always find very complex solutions about it. I have a cell with an non editable scrollable UITextView and I just want to increase the height of that cell to a

I am searching on Google about this but I always find very complex solutions about it. I have a cell with an non editable scrollable UITextView and I just want to increase the height of that cell to a constant value. How can I do it? Actually I am using the next code to add the UITextView to the cell.

cell.contentView.bounds =开发者_Go百科 CGRectMake(0, 0, cell.frame.size.width, cell.frame.size.height);

UITextView *textView = [[UITextView alloc] initWithFrame:cell.contentView.bounds];
textView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
textView.editable = NO;
textView.scrollEnabled = YES;
textView.backgroundColor = [UIColor clearColor];
textView.text = self.description;

[cell.contentView addSubview:textView];
[textView release];

Thanks for reading.


Implement this method in your delegate: http://developer.apple.com/library/ios/documentation/uikit/reference/UITableViewDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UITableViewDelegate/tableView:heightForRowAtIndexPath:

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号