我有一个包含主控制器和详细控制器的 UISplitViewController
:
MyMasterController *masterViewController = [[[MyMasterController alloc] initWithDirectory:directoryElement] autorelease];
MyDetailController *detailViewController = [[MyDetailController alloc] init];
masterViewController.detailViewController = detailViewController;
UISplitViewController *splitViewController = [[UISplitViewController alloc] init];
splitViewController.viewControllers = @[[[UINavigationController alloc] initWithRootViewController:masterViewController], [[UINavigationController alloc] initWithRootViewController:detailViewController]];
splitViewController.delegate = self;
MyDetailController
是一个表格列表视图控制器,我想在用户点击单元格时让主视图控制器运行一个方法,那么如何在详细控制器中获取主控制器?
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[master some_method]; // how to get ?
}