我已经在视图控制器上添加了拆分视图控制器,如下所示:

rootViewController = [[RootViewController alloc] initWithStyle:UITableViewStylePlain];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];

detailViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
rootViewController.detailViewController = detailViewController;

splitViewController = [[UISplitViewController alloc] init];
splitViewController.viewControllers = [NSArray arrayWithObjects:navigationController, detailViewController, nil];
splitViewController.delegate = detailViewController;

[self.view addSubview:splitViewController.view];


但是从未在DetailViewController中定义的此方法被调用:

- (void)splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController: (UIPopoverController*)pc


如果将splitviewcontroller设置为window,则将调用此方法!
有什么建议吗?

最佳答案

据我所知,splitViewController不能是任何其他视图的子视图,因此splitViewController必须始终是mainViewController。

关于iphone - SplitViewController委托(delegate)方法没有响应,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8500780/

10-09 09:15