Daniel García Baena
Daniel García Baena

Reputation: 1201

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

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 = 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.

Upvotes: 0

Views: 1195

Answers (1)

Related Questions