So I have two UITableViews in my ViewController, how do I set the delegate & datasource of the second one to that of another UITableViewController file.
For the second one, I’m currently creating it like this
//now add our second tableview
UITableView *addPapersTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 415)];
addPapersTableView.dataSource = self;
addPapersTableView.delegate = self;
[addPapersView addSubview:addPapersTableView];
And due to the self bit, its obvious pulling data and being delegated from the same file.
Do I do something like #import "AddMoreTableViewController.h" and then something?
Really new to Objective C,
greatly appreciated,
Dex
Add your import as you suggested:
Be sure to create an instance of it, then set it as the delegate/datasource of your other table. Here’s a rough example (I’ll leave the memory management and semantics up to you):
You must ensure that you are implementing the protocols
UITableViewDataSourceandUITableViewDelegateinAddmoreTableViewController.