使用自定义segue动画将一个视图移动到另一个视图?

我正在尝试实现SUBJ,但无法使目标segue出现在我的动画中。 我想为视图更改创建动画,其中新的segue将替换旧的segue。 目前我的perform方法如下所示:

- (void) perform { UIViewController *src = (UIViewController *) self.sourceViewController; UIViewController *dst = (UIViewController *) self.destinationViewController; [UIView animateWithDuration:2.0 animations:^{ //tried a lot of staff to make dst view to fall from top at the same time as current view falling to bottom but failed. src.view.transform=CGAffineTransformMakeTranslation(0, 480); } completion:^(BOOL finished){ [[self sourceViewController] presentModalViewController:[self destinationViewController] animated:NO]; } ]; } 

任何想法如何添加到我的动画块顶部出现的新视图?

非常感谢!

编辑:

 - (void) perform { UIViewController *src = (UIViewController *) self.sourceViewController; UIViewController *dst = (UIViewController *) self.destinationViewController; src.view.transform = CGAffineTransformMakeTranslation(0, 0); dst.view.transform = CGAffineTransformMakeTranslation(0, -480); [UIView animateWithDuration:2.0 animations:^{ [src.view addSubview:dst.view]; src.view.transform = CGAffineTransformMakeTranslation(0, 460); } completion:^(BOOL finished){ [src presentModalViewController:dst animated:NO]; } ]; } 

多数民众赞成我最终如何做到这一点。

我不太明白你的意思新旧,所以我假设new = dst和old = src。

 - (void) perform { UIViewController *src = (UIViewController *) self.sourceViewController; UIViewController *dst = (UIViewController *) self.destinationViewController; src.view.transform = CGAffineTransformMakeTranslation(0, 0); dst.view.transform = CGAffineTransformMakeTranslation(0, -480); [UIView animateWithDuration:2.0 animations:^{ [src presentModalViewController:dst animated:NO]; src.view.transform = CGAffineTransformMakeTranslation(0, 480); dst.view.transform = CGAffineTransformMakeTranslation(0, 0); } ]; } 

这应该做到这一点。