分配给表格单元格的高度默认为tvos中的选择

时间:2016-04-26 14:54:27

标签: xcode uitableview tvos tvos9.1

我的tvOS应用程序中有一个表格视图,其自定义行高为250px(不是很多)。每个单元格的内容是一个文本视图,它具有(再次)200px的恒定高度。当表格加载时,尺寸在初始渲染时看起来很好。

On render

但是当我实际关注单元格时,它默认为某个初始高度:

On selection

我试图在加载时为表格视图提供estimatedRowHeight

tableView.estimatedRowHeight = 250
tableView.rowHeight = UITableViewAutomaticDimension

即使在UITableViewDelegate中实施行高方法也无济于事:

func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
    return UITableViewAutomaticDimension
}

func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
    return UITableViewAutomaticDimension
}

我想我错过了一些非常简单的东西,但我想不出什么。提前谢谢。

0 个答案:

没有答案