我有一个tableView
,每个tableViewCell
中都有一个collectionView
。
我尝试使用以下代码更改collectionView
的大小:
func collectionView(_ collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
sizeForItemAt indexPath: IndexPath) -> CGSize {
if collectionView.tag == 2{
return CGSize(width: 100, height: 100)
}else if collectionView.tag == 4 {
return CGSize(width: 222, height: 200)
}else{
return CGSize(width: 10, height: 10)
}
}
问题在于没有错误,但单元格大小不会改变。
如果您需要了解更多信息,请撰写评论。
谢谢。
tableView
,但这看起来像是一个collectionView
。你两个都有吗,还是只有一个? - brandonscript