๋ฐ์ํ
Exception NSException * "UICollectionView must be initialized with a non-nil layout parameter" 0x000060000266a430
์๋ฌ ๋ฉ์์ง์์ ์ ์ ์๋ฏ์ด UICollectionView๋ nil ํ์ ์ด ์๋ layout ํ๋ผ๋ฏธํฐ๋ก ์ด๊ธฐํ ํด์ฃผ์ด์ผ ํฉ๋๋ค.
์๋์ ๊ฐ์ ๋ฐฉ๋ฒ์ผ๋ก ์ปฌ๋ ์ ๋ทฐ๋ฅผ ์์ฑํ ๋ ๋ ์ด์์์ผ๋ก ์ด๊ธฐํ ์์ผ ์ฃผ๋ฉด ๋ฉ๋๋ค!
let collectionView: UICollectionView = {
let layout = UICollectionViewFlowLayout()
layout.minimumLineSpacing = 10
layout.scrollDirection = .vertical
layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
let cv = UICollectionView(frame: .zero, collectionViewLayout: layout)
return cv
}()
let cv = UICollectionView(frame: .zero, collectionViewLayout: layout)
(เซญ แ)เซญ
728x90
๋ฐ์ํ
'๐ iOS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[iOS] Xcode ๋ ๋ฒ์ ๊ฐ์ด ๊น๊ธฐ (0) | 2020.09.28 |
---|---|
[Swift] UIViewController ์ UICollectionView ๋ฃ๊ธฐ (0) | 2020.09.28 |
[Swift] ์์ ๊ฐ๋จํ tutorial -> URLSession์ผ๋ก json api ์์ ํ์ฑ๊น์ง (0) | 2020.09.12 |
[Swift] UINavigationController ์ฌ์ฉํ๊ธฐ (0) | 2020.09.08 |
[iOS, Swift] AppDelegate์์ window์ rootViewController ์ค์ ํ๊ธฐ (1) | 2020.08.27 |
๋๊ธ