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

前端 未结 22 2133
面向向阳花
面向向阳花 2020-12-12 17:33

I am fairly new to coding in general and really new to Xcode (Swift). I understand that I need to register a nib or a class but I don\'t understand \'where or how?\'.

<
22条回答
  •  借酒劲吻你
    2020-12-12 18:25

    One more reason for this issue to happen is an earlier problem. When showing a new ViewController, instantiating the target ViewController directly will of course not load the prototype cells from the StoryBoard. The correct solution should always be to instantiate the view controller through the story board like this:

    storyboard?.instantiateViewController(withIdentifier: "some_identifier")
    

提交回复
热议问题