ios - heightForRowAtIndexPath 和自定义 tableviewcell 高度

标签 ios uitableview height customization

我想知道我自己的tableviewcell是不是自定义了指定高度的,这个值和我在heightForRowAtIndexPath中用的不一样。哪个高度将用于单元格。由于我在一个 TableView 中有多个自定义单元格,因此我很难在 heightForRowAtIndexPath 函数中区分它们的每种类型。我只想知道在这种情况下,我可以只使用我为每种类型的单元格定义的单元格高度吗?

最佳答案

您可以实现 UITableViewDelegate 的这个方法

    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

    //The height you desire to have for the row at *indexPath*

    }

关于ios - heightForRowAtIndexPath 和自定义 tableviewcell 高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30991534/

相关文章:

ios - 在 viewDidLoad() 之前调用 UITableViewController 委托(delegate)方法

html - 我的子 DIV 超出了父级。无固定/绝对定位

macos - 根据xcode中的文本、字体、文本颜色计算高度和宽度

ios - UICollectionViewCell宽度的动态变化

ios - 仅对动态 TableView 的第一行禁用滚动

ios - 使用自动续订订阅的应用程序是否需要 Apple In-App Purchase?

ios - 如何获取 UITableViewCell 内标签的高度?

iphone - UITableView 自定义单元格不占用自定义单元格的高度

ios - 允许最后一个 UITableViewCell 滚动到第一行

css - 一行文本的 CSS 高度是多少?好像不是1em