在我们开发过程中可能会遇到UICollectionView的这个Delegate方法的时候不生效,那么是因为什么原因不生效呢?下面我给出一张截图说明一下原因
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize
是图片中红线圈起来的部分设置出的问题,我们需要将这个设置修改为None这样我们写的大小就生效了。