The following methods are part of the UITableViewDataSource
and UITableViewDelegate
protocols
tableView:numberOfRowsInSection:
tableView:cellForRowAtIndexPath:
tableView:didSelectRowAtIndexPath:
and will be called by your table view assuming you've property assigned the table view's delegate
and dataSource
properties. These methods, however,
tableView2:numberOfRowsInSection:
tableView2:cellForRowAtIndexPath:
tableView2:didSelectRowAtIndexPath:
are not part of the protocol and won't ever get called by the table view. It looks like you may be confusing your property names, e.g. tableView
, with with the protocol method names, e.g. tableView:numberOfRowsInSection:
. What you need to do is:
- If you haven't already done so, set your view controller as the
delegate
anddataSource
for both yourtableView
andtableView2
. - In each of the data source and delegate methods that you need to implement, handle the cases for both tables.
For example, your tableView:numberOfRowsInSection:
method would look like:
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (tableView == self.tableView) {
return [existingNames count];
}
else if (tableView == self.tableView2) {
return [names count];
}
return 0;
}