查询Storyboard segues

时间:2013-12-27 12:50:27

标签: ios storyboard

我有3个视图控制器A,B,C,并且可以使用以下自定义段:

A - >乙

A - > ç

B - > ç

B < - C

A&lt; -B

A&lt; - C

现在,执行顺序如下:

点击A和A中的按钮 - &gt; B发生了。

点击B和B中的按钮 - &gt; C发生了。

现在,我需要做以下事情:

单击C中的按钮,A应直接显示。如果我执行C - &gt;一个segue,它向我显示B屏幕,因为B被添加到A.如果我执行,C - &gt; B和B - &gt;按顺序,它适用于我,但我不希望B出现在这里。如何解决这个问题?

感谢。

1 个答案:

答案 0 :(得分:0)

我为B-> C写了一个自定义的segue。它从A中删除'B',并在我的自定义segue类的perform函数中将C的父级设置为A,如下所示。

- (void)perform
{
     UIViewController *B = self.sourceViewController;
     UIViewController *C = self.destinationViewController;
     UIViewController *A = source.parentViewController;

     [A addChildViewController:B];
     [B willMoveToParentViewController:nil];

     [A transitionFromViewController:source
                   toViewController:destination
                           duration:1.0
                            options:UIViewAnimationOptionNone
                         animations:^{
                         }
                         completion:^(BOOL finished) {
                             [B removeFromParentViewController];
                             [C didMoveToParentViewController:container];
  }];
}

然后,如果我调用我的删除segue C-> A,它会删除C并显示A而不是B.

相关问题