在splitview中从详细信息中调用new master

时间:2013-11-12 12:20:59

标签: ios objective-c

HY,

我有一个正常的spitview应用程序,包含1个master和1个细节,我在两者之间进行通信我在appDelegate中设置了这段代码:

UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;

UINavigationController *navigationController = [splitViewController.viewControllers lastObject];
ImageGaleryViewController *rightViewController = (ImageGaleryViewController *)navigationController.topViewController;
splitViewController.delegate = (id)navigationController.topViewController;

UINavigationController *masterNavigationController = splitViewController.viewControllers[0];
CatalogPopUpViewController *controller = (CatalogPopUpViewController *)masterNavigationController.topViewController;
controller.delegate = rightViewController;

现在我想制作第二个主人并且能够在细节之间切换它们,比如有两个按钮并且单击一个打开1s主控其他按钮打开第二个主人,但是想要从主人那里通信到细节也是,设置一个委托,我可以创建一个新的viewcontroller并使一个segue替换为master,但我如何设置委托?从大师到细节的交流?我希望我的问题无法解决。

1 个答案:

答案 0 :(得分:0)

我知道了,我用了

  

[self performSegueWithIdentifier:@“catalogMasterSegue”sender:self];

用master调用master,然后segue准备segue:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if([[segue identifier] isEqualToString:@"catalogMasterSegue"])
    {
        CatalogPopUpViewController *controller=[[[segue destinationViewController]viewControllers]objectAtIndex:0];
        controller.delegate=self;
    }
}