[Swift] CollectionView Layout 비율 맞추기

2017. 9. 4. 12:50Programming/Swift

반응형

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {

    let width = collectionView.frame.width / 4 - 1

    return CGSize(width: width, height: width)

}

 

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {

    return 1.0

}

    

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {

    return 1.0


반응형

'Programming > Swift' 카테고리의 다른 글

[AVPlayer] background audio  (0) 2017.09.11
ttf, otf 폰트 추가하는 법  (0) 2017.09.09
UIImageView 를 다른 UIImageView로 동일한 크기로 처리  (0) 2017.08.21
[ERROR] csqlite, stdatomic.h  (0) 2017.05.18
background to foreground  (0) 2017.04.27