Two UITableView, one master view and one details view
I need some help on displaying data from Master view
to Details view
. When a cell
is selected on Master view
, data will display on details view
. Master Details View
All other class is a xib
file to be loaded on the Details view
which is being outlet
in the container view. The implementation
is to avoid using UISplitViewController.
I'm using objective-c
. Please can anyone help me.
MainContainerViewController.m
+ (MainContainerViewController *)createModalContainer:(NSString*)paramStr{ MainContainerViewController *aController = [[MainContainerViewController alloc] initWithNibName:@"MainContainerViewController" bundle:nil]; aController.title = paramStr return aController; }
- (void)viewDidLoad { [super viewDidLoad]; _masterViewController = [[MasterViewController alloc]init]; [_masterTableView setDataSource:_masterViewController]; [_masterTableView setDelegate:_masterViewController]; _masterViewController.view = _masterViewController.tableView; }
MasterViewController.m
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ switch (indexPath.row) { case 0: DetailsProfileViewController *detailsController = [[DetailsProfileViewController alloc] init]; detailsController.title = @"Details"; MainContainerViewController *container = MainContainerViewController.sharedInstance; [container.detailsTableView setDataSource:detailsController]; [container.detailsTableView setDelegate:detailsController]; detailsController.view = detailsController.tableView; [container.detailsTableView reloadData]; break; } }链接地址: http://www.djcxy.com/p/84424.html