๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
โ—๏ธError

[ํ•ด๊ฒฐ๋ฒ• ํฌํ•จ]'NSInternalInconsistencyException', reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier

by Fomagran ๐Ÿ’ป 2020. 5. 31.
728x90
๋ฐ˜์‘ํ˜•

์ฝœ๋ ‰์…˜๋ทฐ์—์„œ

dequeueReusableCell์—์„œ ์•„์ด๋ดํ‹ฐํ”ผ์–ด๋ฅผ ์ง€์ •ํ•˜๋Š” ๋„์ค‘ ์ด๋Ÿฌํ•œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.

์—ด์‹ฌํžˆ ๊ตฌ๊ธ€๋งํ•œ ๊ฒฐ๊ณผ

collectionView.register(์ฝœ๋ ‰์…˜๋ทฐ์…€ํด๋ž˜์Šค์ด๋ฆ„.self, forCellWithReuseIdentifier: "์ž์‹ ์˜ ์•„์ด๋ดํ‹ฐํ”ผ์–ด ์ด๋ฆ„") ์„ viewDidLoad์— ๋„ฃ์–ด์ฃผ๋ฉด ๋˜์—ˆ๋‹ค.

1
collectionView.register(์ž์‹ ์˜์ฝœ๋ ‰์…˜๋ทฐ์…€ํด๋ž˜์Šค.self, forCellWithReuseIdentifier: "์•„์ด๋ดํ‹ฐํ”ผ์–ด์ด๋ฆ„")
cs

์ž์‹ ์˜ ํด๋ž˜์Šค ์ด๋ฆ„

์ž์‹ ์˜ ์•„์ด๋ดํ…Œํ”ผ์–ด ์ด๋ฆ„

 

728x90
๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€