执行不同的自定义segues

时间:2012-06-13 23:39:46

标签: ios objective-c xcode segue uistoryboardsegue

我有多个视图控制器,我希望在转换到某些视图控制器时执行不同的自定义segue。

我已经为不同的自定义segue正确地创建了代码,并将相应的segue设置为该类。

我的问题是,当我从 ViewControllerA 过渡到 ViewControllerB 时,我希望它能够执行 CustomSegueA &它确实。当我从 ViewControllerB 转换为 ViewControllerC 时,我希望它执行 CustomSegueB ,但它会执行 CustomSegueA 。实际上,每个后续转换都将执行 CustomSegueA 。如果我将 ViewControllerA 转换为 ViewControllerB 转换为 CustomSegueB ,则每次后续转换都将使用 CustomSegueB

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

问题在于自定义segue代码...对于我有的动画

    - (void) perform {

UIViewController *sourceVC = (UIViewController *) self.sourceViewController;
UIViewController *destinationVC = (UIViewController *) self.destinationViewController;

[UIView transitionWithView:sourceVC.view duration:5.0
                   options:UIViewAnimationOptionTransitionCrossDissolve
                animations:^{
                    [sourceVC.navigationController pushViewController:destinationVC animated:NO];
                }
                completion:NULL];

}

中的

    [UIView transitionWithView:sourceVC.view duration:5.0

我把它改成了

    [UIView transitionWithView:sourceVC.navigationController.view duration:5.0

不知道为什么那是差异,唯一的原因是我能够弄明白的是通过查看我工作时的一些旧项目