Swift3.0 에서 셀 사이즈를 변경하는 방법을 알아보았습니다.
- 기존 코드 -
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: 150, height: 150)
}
- Swift3 -
class ViewController: UICollectionViewDelegateFlowLayout, UICollectionViewDelegate {
}
* UICollectionViewDelegateFlowLayout을 추가해주는 부분이 변경되었습니다.
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
} }
댓글 없음:
댓글 쓰기