[英]UICollectionView Cell resizing issue
您必須為 item 方法實現 Size 並且需要確認UICollectionViewDelegateFlowLayout
。
由於每部 iPhone 都有不同的寬度,因此您無法將其設置為靜態寬度。
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: collectionView.frame.width, height: 150)
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.