我有一个自定义的转场:
-(void)perform {
__block UIViewController *sourceViewController = (UIViewController*)[self sourceViewController];
__block UIViewController *destinationController = (UIViewController*)[self destinationViewController];
float duration = 0.5;
NSLog(@"FlipSegue.m - source:%@ dest:%@", sourceViewController, destinationController);
if (self.isUnwinding) {
NSLog(@"FlipSegue.m - isUndwinding - Flipping View 2 to View 1");
//[sourceViewController.navigationController dismissViewControllerAnimated:NO completion:nil];
[UIView transitionWithView:sourceViewController.navigationController.view duration:duration
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^{
[sourceViewController.navigationController dismissViewControllerAnimated:NO completion:nil];
}
completion:NULL];
} else {
NSLog(@"FlipSegue.m - Going Forward - Flipping View 1 to View 2");
//[sourceViewController.navigationController pushViewController:destinationController animated:NO];
[UIView transitionWithView:sourceViewController.navigationController.view duration:duration
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^{
[sourceViewController.navigationController pushViewController:destinationController animated:NO];
}
completion:NULL];
}
}
我已经设置segue
并unwind segue
使用了storyboard
.
我已经子类UINavigationController
化并且正在使用自定义展开segue- (UIStoryboardSegue *)segueForUnwindingToViewController:(UIViewController *)toViewController fromViewController:(UIViewController *)
View 1
当我从to调用 segue时View 2
,它按预期工作。
当我调用 unwind segue 时,View 2
翻转,但View 2
再次显示。这isUnwinding
部分代码会触发,但View 1
不会再次出现。
任何有关如何解决此问题的提示将不胜感激。