UITableViewCells loaded from NIB is always nil

I am trying to create a simple form using UITableViewController

as described in the Apple Developer documentation here .

What I am trying to do is in the section entitled Technique for Static Row Content

I created a pair UITableViewCells

and added them to my nib, but when I try to access them to add them to UITableView

(in the method cellForRowAtIndexPath:

) they are always zero.

It looks like they are not loading properly from the tip. I've double / triple / quadruple checked my code to make sure I am doing it exactly the same way in detail in the docs, but no luck.

Is there something obvious I'm missing here?

+2


a source to share


2 answers


Are you sure you have included IBOutlets in the nib file?

In your ViewController.h file, you must:



IBOutlet UITableViewCell *specialCell1;
IBOutlet UITableViewCell *specialCell2;

      

and then each of them must be "connected" to the corresponding cell in the nib file. If not, they won't!

0


a source


Found it out ...

When I added the parent view controller, I used a simple "init". Switching to "initWithNibName" solved the problem ...



Continuing training ... :)

-1


a source







All Articles