【发布时间】:2016-11-28 21:47:23
【问题描述】:
我正在尝试制作一个根据背景颜色更改单元格高度的应用。我想拥有它,这样如果它们的背景颜色是青色或橙色,单元格会更小,但我似乎找不到正确的方法。我有更改高度的代码,但我不知道要使用的正确参数。
override func tableView(tableView: UITableView,
heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
if indexPath.row == 1 {//should be if cell.backgroundcolor or something
return 100 //noncolored cells
} else {
return 20 // colored cells
}
}
【问题讨论】:
-
你能解决这个问题吗?
标签: swift uitableview cell background-color