0

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 のテキストは変更されません。

何か不足していますか?

4

1 に答える 1

0

私も MGSplitViewController を使用していますが、マスター ビューと詳細ビューの間の通信をセットアップする必要があるように思えます。デモ プロジェクトを見ると、その効果のためにデリゲートが使用されていることがわかります。

于 2013-04-16T14:23:48.593 に答える