[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];
}];
My destinationController has 2 views one over the other. View #1 is the main view and totally visible and View #2 that is half visible half hidden. When I use the code above and move between segues I can see (while going from alpa 0 to 1) the hidden view completely under the main view. So the user can see what is hidden under there. (even if I make the animateWithDuration really fast). I don’t know why this is happening and trying to find a creative solution. One solution I came up with is using an animation inside the ViewController
[UIView animateWithDuration:0.7 animations:^() {_image.alpha = 1;}];
and by that “slowing down” the hidden view but obviously the view is loaded in a delay and doesn’t look so elegant on the visible part of the hidden view.
Thanks
You could hide the partly hidden view first, just before your animation, or set up another animation (which will run concurrently) to set the hidden view’s alpha to 0. Run this animation at the same or faster rate than your main view animation.