Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing UITableView without a Controller - getting unrecognized selector error
    primarykey
    data
    text
    <p>I'm not sure if I'm going about this right. All the tutorials I've seen suggest that nearly all the controls, which are views, are handled by their own ViewController. But the Apple docs clearly state that it should be one ViewController per screen, and I have more than one thing going on per screen. If I'm supposed to have multiple ViewControllers per screen, how do I hook that up in IB?</p> <p>I've put a UITableView onto my main view, and then I created a custom class to handle it. I implemented the UITableViewDataSource and UITableViewDelegate protocols necessary, and then I added it as an object into my XIB file. I hooked up the table to that object, and I made sure to set the class of the object to the one I created.</p> <p>The problem is, simply having a <code>willSelectRowAtIndexPath</code> method defined in my custom class causes the app to crash when I click a table row, with an "unrecognized selector" error. I've gone through dozens of forums and such looking for the answer, but they're all about making sure the class is set right (mine is) or something about leaking memory (for people who didn't use IB to create it.) So I'm totally at a loss now for why this is happening. Is it because my custom class isn't a subclass of UIViewController?</p> <p>edit: I fixed the actual issue by moving the code into my main UIViewController, and setting the table's datasource and delegate to that (the File's Owner) and it works. But I'm still very confused on why it refused to work before. All the links and properties seem to have been set up just fine.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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