【发布时间】:2017-11-13 09:37:29
【问题描述】:
我想调整这个功能(最初是为collectionView创建的)
let place = places[indexPath.row]
let annotationPadding = CGFloat(5)
let font = UIFont.systemFont(ofSize: 15)
let commentHeight = place.heightForComment(font, width: width)
let height = annotationPadding + commentHeight + annotationPadding
return height
所以我可以将它添加到我的tableView 中的func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { },我该怎么做? (我的问题是CGFloat不接受width)
【问题讨论】:
-
将宽度创建为局部变量,例如 var width: CGFloat = 0 并在您有宽度时设置它。
标签: ios swift uitableview swift3 uicollectionview