lrb333
lrb333

Reputation: 65

UITableView: connection issues in IB

I'm having an issue connecting my UITableView in IB. I am almost exactly following code from a tutorial so I know that there should be 4 connections: table to File's Owner (select delegate), table to File's Owner (select datasource), File's Owner to table (select view), File's Owner to table (select tableView).

My problem is with that last connection. When I drag from File's Owner to table, the only option I see is view. WHY ISN'T TABLEVIEW UP THERE?

I think that this problem is why I get a blank screen when I run my code. And I've been going crazy trying to understand why my code is wrong but the tutorial's works. So please, any and all help is highly appreciated =]

Upvotes: 0

Views: 577

Answers (2)

vdaubry
vdaubry

Reputation: 11439

You're making a mistake, your UITableView is a subview of UIView :

So your links should be :

  • table to File's Owner (select delegate)
  • table to File's Owner (select datasource)
  • File's Owner to view (select view) : this connection is made automatically
  • File's Owner to table (select tableView).

If your tableView is not showing in IB that's probably because you didn't declare it as an IBOutlet inside your controller's header file.

I suggest you have a look at "Creating and Configuring a Table View" in the Table View programming guide :

http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/CreateConfigureTableView/CreateConfigureTableView.html#//apple_ref/doc/uid/TP40007451-CH6-SW10

You can also find an example in the "TableViewSuite" sample code from Apple :

http://developer.apple.com/library/ios/samplecode/TableViewSuite/TableViewSuite.zip

Hope this helps, Vincent

Upvotes: 1

justin
justin

Reputation: 5831

do you have a UITableView specified in your File's Owner class? make sure you have the following in the class you set as File's Owner

in @interface:

UITableView *myTableView;

and

@property (nonatomic, retain) IBOutlet UITableView *myTableView;

then in IB, right click on File's Owner and you should see myTableView as an outlet. drag that to the tableView on screen and you should be ready to go

Upvotes: 0

Related Questions