我在tableview单元格内有collectionview,并且将nib用作我的collectionview单元格(在其中我对imageview和label使用autolayout,它处于Freeform模式下)。我在tableviewcell类中设置单元格大小,该类正在通过此方法在其中处理collectionview的委托:
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: 200, height :150)
}
Run Code Online (Sandbox Code Playgroud)
它始终有效,但在Xcode 11之后无效。