【发布时间】:2018-04-25 08:08:02
【问题描述】:
我是初学者,我想知道如何添加这个为 UICollectionView 创建的函数
func heightForAnnotationAtIndexPath(indexPath: IndexPath, withWidth width: CGFloat) -> CGFloat {
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
}
里面
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 130
}
因为与 tableView 中的 collectionView 不同,我只需要高度值,因为没有列
【问题讨论】:
标签: ios swift uitableview swift3 uicollectionview