Reputation: 16790
I want to display the contents of an array in the tableView but the control never comes into cellForRowAtIndexPath. This method is where I add
cell.textLabel.text = [self.itemArray indexPath.row];
Please advise. how do you populate the table?
Upvotes: 1
Views: 8402
Reputation: 3494
Are you sure it's not being called try putting a NSLog(@"TEST")
see the output.
That sounds a lot like the table view datasource
being empty the first time sow you might want to check if the array has objects saved.
Also you might want to check and see if numberOfSectionsInTableView
table to be set at 1, and numberOfRowsInSection
not equal 0. If numberOfRowsInSection
returns 0 then the cellForRowAtIndexPath
may not be called.
Upvotes: 16
Reputation: 1985
Have you implemented the other methods in UITableViewController:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.itemArray count];
}
If these return 0, then your cellForRowAtIndexPath method wont be called.
Upvotes: 3