[sourceViewController.view addSubview:destinationController.view];
[destinationController.view setFrame:sourceViewController.view.window.frame];
[destinationController.view setTransform:CGAffineTransformMakeScale(0.5,0.5)];
[destinationController.view setAlpha:0.0];
[UIView animateWithDuration:0.3
delay:0.0
options:UIViewAnimationCurveEaseOut
animations:^{
[destinationController.view setTransform:CGAffineTransformMakeScale(1.0,1.0)];
[destinationController.view setAlpha:1.0];
//[sourceViewController.view setAlpha:0];
}
completion:^(BOOL finished){
[destinationController.view removeFromSuperview];
[sourceViewController.navigationController pushViewController:destinationController animated:NO];
}];
私のdestinationControllerには2つのビューがあります。ビュー#1はメインビューであり、完全に表示されます。ビュー#2は、半分が表示され、半分が非表示になっています。上記のコードを使用してセグエ間を移動すると、メインビューの下に完全に隠されたビューが表示されます(alpa 0から1に移動している間)。そのため、ユーザーはその下に何が隠されているかを確認できます。(私がanimateWithDuration
本当に速くしたとしても)。なぜこれが起こっているのか、創造的な解決策を見つけようとしているのかわかりません。私が思いついた解決策の1つは、内部でアニメーションを使用することです。ViewController
[UIView animateWithDuration:0.7 animations:^() {_image.alpha = 1;}];
そして、それによって非表示のビューが「遅くなる」が、明らかにビューは遅れて読み込まれ、非表示のビューの表示部分ではそれほどエレガントに見えません。
ありがとう