I think the best way to do this is, instead of using three separate controllers, just to use one. This one controller will be a subclass of UIViewController, and its .h file should look something like this:
@interface MyController : UIViewController <UITableViewDataSource, UITableViewDelegate>
UITableView *firstTableView;
UITableView *secondTableView;
@end
Now, in your .m file, set the tables up like so:
- (id)init {
if ((self = [super init])) {
firstTableView = [[UITableView alloc] initWithFrame:/*desired frame*/ style:/*desired style*/];
secondTableView = [[UITableView alloc] initWithFrame:/*desired frame*/ style:/*desired style*/];
firstTableView.delegate = self;
firstTableView.dataSource = self;
secondTableView.delegate = self;
secondTableView.dataSource = self;
}
}
- (void)dealloc {
[firstTableView release];
[secondTableView release];
[super dealloc];
}
Then, implement desired UITableViewDataSource methods like so:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (tableView == firstTableView) {
// Do something
} else if (tableView == secondTableView) {
// Do something else
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
if (tableView == firstTableView) {
// Configure the cell
} else if (tableView == secondTableView) {
// Configure the cell a different way
}
}
Finally, in didSelectRowAtIndexPath:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (tableView == firstTableView) {
// Update something that is linked to the return values of secondTableView's dataSource methods
[secondTableView reloadData];
}
}
This approach ensures that your controller gets the right -viewDidLoad, -viewWillAppear, and so on, automatically. Remember, just adding view controller's views as subviews means that your controller will not receive these calls.