我想实现这一目标: Ideal
但这是到目前为止我得到的: now
这是我现在拥有的代码:
extension Profile_PhotosUpload: UICollectionViewDelegateFlowLayout{
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let bigSize = CGSize(width: 180.0, height: 180.0)
let smallSize = CGSize(width: 70, height: 70)
if indexPath.row == 0{
return bigSize
}else{
return smallSize
}
}
// Horizontal Space
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
return 5
}
// Vertical Space
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 10
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
return UIEdgeInsets(top: -60, left: 0, bottom: 0, right: 0)
}
}
请有人帮忙。