我正在尝试使用 MGSplitViewController,但不是将其设置为 rootViewController,而是希望它以模态方式显示。这是我目前使用的代码
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath: (NSIndexPath *)indexPath
{
if(splitViewController == nil)
{
self.splitViewController = [[MGSplitViewController alloc] init];
self.rootViewController = [[RootViewController alloc] init];
self.detailViewController = [[DetailViewController alloc] init];
}
[splitViewController setViewControllers:[NSArray arrayWithObjects:rootViewController, detailViewController, nil]];
if (NO) { // whether to allow dragging the divider to move the split.
splitViewController.splitWidth = 15.0; // make it wide enough to actually drag!
splitViewController.allowsDraggingDivider = YES;
}
splitViewController.delegate = detailViewController;
[rootViewController performSelector:@selector(selectFirstRow) withObject:nil afterDelay:0];
[detailViewController performSelector:@selector(configureView) withObject:nil afterDelay:0];
[self presentViewController:splitViewController animated:YES completion:nil];
}
这几乎可以正常工作,但 detailViewController 中的按钮不起作用。他们什么都不做。此外,当我单击左侧面板中的按钮时,detailViewController 中的文本不会像在同一项目中那样更改。
我错过了什么吗?