I am using a custom unwind segue in a navigation controller, in the animation of the segue the navigation bar is not visible during the animation, when the animation ends the navigation bar 'pops'. ¿How can i retain the visibility of the navigation bar during the animation?
More details:
I have a button in the navigation bar that calls modal view this animation performs as expected, the new view has a button to trigger the unwind segue animation the view to grow and disappear, while this animation is performing the Navigation Bar in the destination view controller is not visible until the animation is finished.
This is the code i'm using for the custom segue.
- (void) perform {
UIViewController *sourceViewcontroller = self.sourceViewController;
UIViewController *destinationViewcontroller = self.destinationViewController;
[sourceViewcontroller.view.superview insertSubview:destinationViewcontroller.view atIndex:0];
[destinoViewcontroller beginAppearanceTransition:YES animated:YES];
[UIView animateWithDuration:0.2
delay:0.0
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
origenViewcontroller.view.transform = CGAffineTransformMakeScale(1.5, 1.5);
origenViewcontroller.view.alpha = 0.0;
}
completion:^(BOOL finished){
[destinationViewcontroller.view removeFromSuperview];
[sourceViewcontroller dismissViewControllerAnimated:NO completion:NULL];
}];
}
Ok, so i think i got it, what i did was inserting the whole navigation controller view in the superview of the source view and removing the code to remove the destination view from the superview and setting to YES the option of dismissViewControllerAnimated like this:
- (void) perform {
UIViewController *origenViewcontroller = self.sourceViewController;
UIViewController *destinoViewcontroller = self.destinationViewController;
[origenViewcontroller.view.superview insertSubview:destinoViewcontroller.navigationController.view atIndex:0];
[UIView animateWithDuration:0.4
delay:0.0
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
origenViewcontroller.view.transform = CGAffineTransformMakeScale(2.0, 2.0);
origenViewcontroller.view.alpha = 0.0;
}
completion:^(BOOL finished){
[origenViewcontroller dismissViewControllerAnimated:YES completion:NULL];
}];
}
I'm still not sure if this is the correct way to do it.