๐Ÿ’ป ๊ฐœ๋ฐœ/์˜ค๋Š˜์˜ ์‚ฝ์งˆ

[iOS / Swift] unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard

2022. 8. 21. 14:52
๋ชฉ์ฐจ
  1. ์ฐธ๊ณ 

TableView๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด์„œ Cell์„ ์žฌ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด extension์œผ๋กœ UITableViewDataSource๋ฅผ ์žฌ์ •์˜ํ•˜๊ณ  ๋นŒ๋“œ๋ฅผ ์ง„ํ–‰ํ–ˆ๋‹ค.

extension ViewController : UITableViewDataSource {
    func tableView(_ tableView : UITableView, numberOfRowsInSection section : Int) -> Int {
        return self.tasks.count
    }
    
    func tableView(_ tableView : UITableView, cellForRowAt indexPath : IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for : indexPath)
        let task = self.tasks[indexPath.row]
        
        cell.textLabel?.text = task.title
        
        return cell
    }
}

 

์•ฑ์€ ์ •์ƒ์ ์œผ๋กœ ์‹คํ–‰๋์ง€๋งŒ ์ƒˆ๋กœ์šด task๋ฅผ ๋“ฑ๋กํ•˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.

unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard

 

ํ•ด์„ํ•ด๋ณด๋ฉด ์Šคํ† ๋ฆฌ๋ณด๋“œ์˜ ์…€๊ณผ ์—ฐ๊ฒฐ๋˜์–ด ์žˆ์ง€ ์•Š๋‹ค๋Š” ์˜ค๋ฅ˜์˜€๋‹ค. 

์Šคํ† ๋ฆฌ๋ณด๋“œ์—์„œ Cell์˜ identifier๋ฅผ ํ™•์ธํ•ด๋ณด๋‹ˆ ์„ค์ •๋˜์–ด ์žˆ์ง€ ์•Š์•˜๊ณ  ์ด๋ฅผ Cell๋กœ ๋ณ€๊ฒฝํ•ด์คฌ๋”๋‹ˆ ์ •์ƒ์ ์œผ๋กœ ์ž‘๋™ํ–ˆ๋‹ค.

 

๊ณต์‹ ๋ฌธ์„œ์— ์จ์ ธ์žˆ์Œ!

์ฐธ๊ณ 

- tableView(_:numberOfRowsInSection:)

 

Apple Developer Documentation

 

developer.apple.com

- dequeueReusableCell(withIdentifier:for:)

 

Apple Developer Documentation

 

developer.apple.com

์ €์ž‘์žํ‘œ์‹œ ๋น„์˜๋ฆฌ ๋ณ€๊ฒฝ๊ธˆ์ง€ (์ƒˆ์ฐฝ์—ด๋ฆผ)

'๐Ÿ’ป ๊ฐœ๋ฐœ > ์˜ค๋Š˜์˜ ์‚ฝ์งˆ' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[iOS / Swift] URL Encoding = nil...? (URL ์ธ์ฝ”๋”ฉ์ด ๋˜์ง€ ์•Š์„ ๋•Œ)  (1) 2022.09.22
[iOS / Swift] Exception NSException * "-[UIView setText:]: unrecognized selector sent to instance  (0) 2022.09.07
[Android / Gradle] mockup1/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.  (0) 2022.08.13
[Android / Gradle] The current Gradle version is not compatible with the Kotlin Gradle plugin  (0) 2022.08.09
[Android / Kotlin] Failed to call observer method  (0) 2022.03.30
  1. ์ฐธ๊ณ 
'๐Ÿ’ป ๊ฐœ๋ฐœ/์˜ค๋Š˜์˜ ์‚ฝ์งˆ' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€
  • [iOS / Swift] URL Encoding = nil...? (URL ์ธ์ฝ”๋”ฉ์ด ๋˜์ง€ ์•Š์„ ๋•Œ)
  • [iOS / Swift] Exception NSException * "-[UIView setText:]: unrecognized selector sent to instance
  • [Android / Gradle] mockup1/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.
  • [Android / Gradle] The current Gradle version is not compatible with the Kotlin Gradle plugin
kodo_o
kodo_o
iOS ๊ฟ€์žผ!
kodo_o
๐ŸŽ๐Ÿ
kodo_o
์ „์ฒด
์˜ค๋Š˜
์–ด์ œ
  • ๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ (149)
    • ๐Ÿ”จ ํ”„๋กœ์ ํŠธ (0)
      • TP 1 (0)
      • WhiteHCCTV (0)
      • FootPrint (0)
    • ๐Ÿ’ป ๊ฐœ๋ฐœ (63)
      • iOS (30)
      • Android (6)
      • Kotlin (4)
      • Flutter (9)
      • Node.js (5)
      • Architecture (1)
      • ์˜ค๋Š˜์˜ ์‚ฝ์งˆ (7)
      • ์—๋Ÿฌ์™€์˜ ๋™์นจ (1)
    • โœ๏ธ ์•Œ๊ณ ๋ฆฌ์ฆ˜ (6)
      • Graph (6)
      • String (0)
      • Sort (0)
    • โœ๏ธ ์ฝ”ํ…Œ ์ค€๋น„ (44)
      • Math (1)
      • Implementation (3)
      • String (3)
      • Brute Force (5)
      • Back Tracking (7)
      • Greedy (0)
      • Dynamic Programming (13)
      • Binary Search (1)
      • DFS, BFS (5)
      • Shortest Path (2)
      • Two Pointer (4)
      • MST (0)
    • ๐Ÿ“š CS (6)
      • Operating System (6)
    • โ›น๏ธ ๋ผ์ดํ”„ (30)
      • 2020 ๊ฒจ์šธ๋ฐฉํ•™ ๋ชจ๊ฐ์ฝ”(๊ฐœ์ธ) (12)
      • 2021 ์—ฌ๋ฆ„๋ฐฉํ•™ ๋ชจ๊ฐ์ฝ”(๊ฐœ์ธ) (6)
      • ์ฝ”๋”ฉ ํ…Œ์ŠคํŠธ (1)
      • ํšŒ๊ณ  (10)

๋ธ”๋กœ๊ทธ ๋ฉ”๋‰ด

  • ํ™ˆ
  • ๊นƒํ—ˆ๋ธŒ

์ธ๊ธฐ ๊ธ€

์ตœ๊ทผ ๊ธ€

์ตœ๊ทผ ๋Œ“๊ธ€

hELLO ยท Designed By ์ •์ƒ์šฐ.
kodo_o
[iOS / Swift] unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard
์ƒ๋‹จ์œผ๋กœ

ํ‹ฐ์Šคํ† ๋ฆฌํˆด๋ฐ”

๋‹จ์ถ•ํ‚ค

๋‚ด ๋ธ”๋กœ๊ทธ

๋‚ด ๋ธ”๋กœ๊ทธ - ๊ด€๋ฆฌ์ž ํ™ˆ ์ „ํ™˜
Q
Q
์ƒˆ ๊ธ€ ์“ฐ๊ธฐ
W
W

๋ธ”๋กœ๊ทธ ๊ฒŒ์‹œ๊ธ€

๊ธ€ ์ˆ˜์ • (๊ถŒํ•œ ์žˆ๋Š” ๊ฒฝ์šฐ)
E
E
๋Œ“๊ธ€ ์˜์—ญ์œผ๋กœ ์ด๋™
C
C

๋ชจ๋“  ์˜์—ญ

์ด ํŽ˜์ด์ง€์˜ URL ๋ณต์‚ฌ
S
S
๋งจ ์œ„๋กœ ์ด๋™
T
T
ํ‹ฐ์Šคํ† ๋ฆฌ ํ™ˆ ์ด๋™
H
H
๋‹จ์ถ•ํ‚ค ์•ˆ๋‚ด
Shift + /
โ‡ง + /

* ๋‹จ์ถ•ํ‚ค๋Š” ํ•œ๊ธ€/์˜๋ฌธ ๋Œ€์†Œ๋ฌธ์ž๋กœ ์ด์šฉ ๊ฐ€๋Šฅํ•˜๋ฉฐ, ํ‹ฐ์Šคํ† ๋ฆฌ ๊ธฐ๋ณธ ๋„๋ฉ”์ธ์—์„œ๋งŒ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค.