views:

523

answers:

3

I have been going through and re-creating Apple's "Advanced Table View Cells" example to better understand everything. I have done everything, but somehow missed one detail and I can't figure it out.

If you launch their example (http://developer.apple.com/iphone/library/samplecode/AdvancedTableViewCells/Introduction/Intro.html) and open up the RootViewController.xib file, they have a "tableView" outlet on the inspector that is linked to File's Owner. For whatever reason, I can't get that to show up on my version.

My code is almost verbatim of Apple's, so what am I missing? Did I not declare that somewhere or doesn't that get taken from the RootViewController.m file?

+1  A: 

Their RootViewController subclasses UITableViewController. It is this that generates the tableView outlet.

Andiih
I have it subclassed, but it does not show up as an outlet. The reason I'm asking all of this is because I cannot get the table cell data to load into the cell. I have set up NS Logs and during scrolling it correctly states what is supposed to be loaded into the cell, but it never makes it into the actual cell.I'm just thinking that maybe the tableView not being connected is causing this but I could be wrong
iWasRobbed
+1  A: 

Did you set File's Owner to the class of the object you are trying to link to?

To check if you did so, open your xib file, and see if the File's Owner type is the class you want to link to.

If it doesn't and reads something else like NSObject, open the inspector, go to the Identity tab (Cmd+4), click File's Owner and in the Class Identity section, there's a dropdown menu with the list of classes in your project. Select your UITableViewController subclass and then try to make the link.

Nico
A: 

So after being bugged by this problem for a while... I figured out a workaround. Please note that all of my code was exactly the same as Apple's and yet IB would never show a tableView outlet (as if it wasn't subclassing UITableView properly in my UINavigation Controller).

Essentially all I did was change the subclass from a UITableViewController to a UIViewController and then called the delegate and datasource protocols. After doing that and creating my own tableView outlet, I was finally able to hook up the tableView and get it working as it should.

@interface RootViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {

used to be

@interface RootViewController : UITableViewController {
iWasRobbed