Note that there are some explanatory texts on larger screens.

plurals
  1. POCreate custom class for Navigation Controller (Immediate crash)
    text
    copied!<p><em>First of all, I'm a newbie so please bare with me here..</em> I'm working on a Storyboards based app which constitutes of <strong>multiple view controllers</strong> linked via a <strong>Navigation Controller</strong> (initial view controller). This is used as the home screen. <strong>I'm using static cells and a static table view</strong>.</p> <p>Now, I want to hook up some labels, buttons, etc as outlets/actions to "<em>the .h</em>" file and subsequently write custom methods in the .m file. But (as expected?) there's yet no custom class to select from in the <strong>identity inspector</strong>. So I created a new custom class as a subclass of <strong>UITableViewController</strong> (<em>which seems to be the correct one?</em>)</p> <p>My new, custom class is now hooked up to my storyboard view controller. I then enter (what I believe to be) the correct <strong>numberOfSectionsInTableView</strong>: 1, and <strong>numberOfRowsInSection</strong>:5 (I got 1 section including 5 rows). When ran, it immediately crashes with the following error:</p> <p><em>Terminating app due to uncaught exception '<code>NSInternalInconsistencyException</code>', reason: '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'</em></p> <p>If return 0 sections and 0 rows, everything works fine (expect there are no rows displayed). <strong>Once I return anything > 0 in either of them, it crashes with this error.</strong></p> <p>What have I missed? Is there anything else I'm supposed to add to the file before it can be attached as a custom class and I can use it as any other custom class? Again, I've set up everything in the interface builder (storyboard), including the table cell rows, its styling, etc. What am I doing wrong?</p> <h2>Edit</h2> <p>My Table View Setup</p> <p><img src="https://i.stack.imgur.com/UMNua.png" alt="My Table View Setup"></p> <p>My Table Cell Setup</p> <p><img src="https://i.stack.imgur.com/zRbTC.png" alt="enter image description here"></p> <h2>Solution</h2> <ol> <li>Adding "Cell" as the identifier to all table cell </li> <li>Removed the table view data source methods.</li> </ol> <p>Thanks to danh and rdelmar!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload