自定义放松Segue

时间:2013-06-04 16:22:51

标签: ios cocoa-touch uistoryboardsegue

this question类似,我构建了一个自定义segue,显示目标视图从顶部向下推动源视图。现在我正在尝试构建一个完成相同动画的展开segue,但相反。知道怎么回事吗?

1 个答案:

答案 0 :(得分:0)

您可以通过执行以下检查来使用相同的自定义segue类:

// check if the sourceViewController has been presented modally with a navigationController or just by itself.
UIViewController*presentingViewController = nil;
if ([sourceViewController.presentingViewController isKindOfClass:[UINavigationController class]]) {
    presentingViewController = sourceViewController.presentingViewController;
}
else {
    presentingViewController = sourceViewController;
}

// check which animation we need to perform
if ([destinationViewController.presentingViewController isEqual:presentingViewController]) {
    // animation for unwind segue
    ...
}
else {
    // animation for presenting segue
    ...
}