0

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

4

1 回答 1

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
    ...
}
于 2013-06-16T20:43:52.107 回答