當我執行下面的代碼UICollectionView細胞不能更新框架:通過使用sizeForItemAt方法斯威夫特:當執行sizeForItemAtIndexPath
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize{
let cellW = (ScreenWidth - 10 - 10 - 30)/4
return CGSize(width: cellW, height: cellW * 1.5)
}
,我可以畫幀我想要什麼,但我自定義的CollectionView細胞無法更新爲明智,我錯過了什麼,PLZ幫助我!
添加約束你的圖片前/後/頂的SuperView?併爲底部視圖添加缺少的約束? – Larme
我已經爲我的imageview和標籤添加了約束,看起來像collectionview單元格的問題,也許我在awakefromNib中丟失了一些東西? http://imgur.com/a/6N9qC –
http://imgur.com/a/XOVTn這是我的故事板collectionview單元框架 –