Reputation: 11930
I'm using XCODE 4.2 on iOS5.
I have created a UITableViewController custom, called picker. This is the class content:
NSMutableArray *_nameCollection;
NSMutableArray *_imageCollection;
With 2 elements each. That works well. If I create programmatically a UITableview, it shows the data correctly.
On the view, I declare the class (inside (void)viewDidLoad
):
self.Picker = [[Picker alloc] initWithStyle:UITableViewStylePlain];
_Picker.delegate = self;
PickerTableViewIB = _Picker.tableView; // Try to link using a IBOutlet
PickerTableViewIB is an Outlet from a Tableview, created inside a subview, using Interface Builder.
What is missing?
Upvotes: 4
Views: 192
Reputation: 381
Are you setting the data source as well? You need that for the table view to get the data for populating. Otherwise the cellForRow
method will not be called and your cells will not be populated.
_Picker.dataSource = self;
It would also be a good idea to call [self.Picker reloadData];
after setting the dataSource.
Upvotes: 1