0
[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是一半可见半隐藏。当我使用上面的代码并在segues之间移动时,我可以看到完全在主视图下的隐藏视图(从alpa 0到1)。所以用户可以看到那里隐藏的内容。 (即使我让animateWithDuration
真的很快)。我不知道为什么会发生这种情况,并试图找到一个有创意的解决方案。一个解决方案,我想出了使用ViewController
主视图下的半隐藏视图显示在alpha阶段
[UIView animateWithDuration:0.7 animations:^() {_image.alpha = 1;}];
内,并通过动画“放慢”的隐藏视图,但显然该视图的延迟加载,不看就可见部分如此优雅隐藏的视图。
感谢