2010-11-11 19 views
0

我在谷歌上搜索這件事,但我總是找到非常複雜的解決方案。我有一個帶有不可編輯的可滾動UITextView的單元格,我只是想將該單元格的高度增加到一個常量值。我該怎麼做?實際上,我正在使用下一個代碼將UITextView添加到單元格。如何將單個UITabelViewCell的高度設置爲常量值?

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]; 

感謝您的閱讀。

回答

3
+0

謝謝jxpx777。這裏我自己的解決方案 - (CGFloat的)的tableView:(UITableView的*)的tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { \t \t如果(!(indexPath.section = SECTION_NUMBER)){// 返回默認的行高。 \t \t return 44; } else { //返回默認行高的三倍。 \t \t return 44 * 3; } } – 2010-11-11 18:30:18

相關問題