简体   繁体   English

使iOS表格视图单元格的最大高度不要求滚动

[英]Make iOS table view cell maximum height where no scrolling is required

I have an grouped table view in iOS with 2 static cells and the first cell has a static height. 我在iOS中有2个静态单元格的分组表格视图,第一个单元格具有静态高度。 I want to make height of the second cell maximum without scrolling is required for the table view. 我想使第二个单元格的高度最大,而表格视图不需要滚动。 What is the best way to achieve this? 实现此目标的最佳方法是什么?

Try the contentSize method, used to calculate the table's layout. 尝试使用contentSize方法,该方法用于计算表的布局。

- (CGFloat)tableViewHeight
{
   [tableView layoutIfNeeded];
   return [tableView contentSize].height;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM