UINavigationBar fades when pushing/popping - ios

I am using the old (pre-iOS7) push/pop animation by using the method described here:
#implementation UINavigationController (Retro)
- (void)pushViewControllerRetro:(UIViewController *)viewController {
CATransition *transition = [CATransition animation];
transition.duration = 0.25;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromRight;
[self.view.layer addAnimation:transition forKey:nil];
[self pushViewController:viewController animated:NO];
}
- (void)popViewControllerRetro {
CATransition *transition = [CATransition animation];
transition.duration = 0.25;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromLeft;
[self.view.layer addAnimation:transition forKey:nil];
[self popViewControllerAnimated:NO];
}
#end
My problem is that iOS7 seems to fade the UINavigationBar of the previous view controller when pushing a new view controller. Normally this looks fine because iOS 7 is dragging the views on top of each other. But when I am using the pre-iOS7 animation it gives me a short flash, because the navigation bar fades while the new view it getting pushed in from the right side.
Is there a way to disable the fade animation on the navigation bar?

Related

CATransition working wrong on orientation change before dismissing a NavigationViewController

Here is my code used to present a navigationViewController :
-(IBAction)showFilterView:(id)sender {
FilterViewController *vc=[self.storyboard instantiateViewControllerWithIdentifier:#"FilterViewController"];
UINavigationController *nvc=[[UINavigationController alloc] initWithRootViewController:vc];
CATransition *transition = [CATransition animation];
transition.duration = 0.35;
transition.timingFunction =
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionMoveIn;
transition.subtype = kCATransitionFromLeft;
UIView *containerView = self.view.window;
[containerView.layer addAnimation:transition forKey:nil];
[self.tabBarController presentViewController:nvc animated:NO completion:nil];
}
And here is my code to dismiss
-(IBAction)back:(id)sender {
CATransition *transition = [CATransition animation];
transition.duration = 0.35;
transition.timingFunction =
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionMoveIn;
transition.subtype = kCATransitionFromRight;
UIView *containerView = self.view.window;
[containerView.layer addAnimation:transition forKey:nil];
[[self.navigationController presentingViewController] dismissViewControllerAnimated:NO completion:nil];
}
Situation 1 --- Working well in landscape mode
Situation 2 --- Working well in portrait mode
Situation 3 --- Presenting in a portrait mode and dismissing in landscape mode not working properly(extra animation before displaying correct view)
Situation 4 ---Presenting in a landscape mode and dismissing in portrait mode not working properly(extra animation before displaying correct view)
The UIWindow layer has weird rotation properties and any animations you perform aren't guaranteed to correctly detect orientation (and vary with different iOS versions). The easiest way to do what you're trying to is with a custom presentation animation. This is a good writeup of how to do it.

How to do presentViewController transition from Right to left and dissmissViewController for it reverse?

for transition from one viewController to another view i wrote code below like this
if (UIInterfaceOrientationIsLandscape(STATUSBAR_ORIENTATION)) {
transition = [CATransition animation];
transition.duration = 0.3;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromBottom;
[self.view.window.layer addAnimation:transition forKey:nil];
}
else
{
transition = [CATransition animation];
transition.duration = 0.3;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromLeft;
[self.view.window.layer addAnimation:transition forKey:nil];
}
[self presentViewController:webView animated:NO completion:nil];
It is working fine but when i am rotate in landscape to portrait at the time onwards the view transition from right to left coming how to resolve this...please help me

Unable to change the popviewcontrolleranimation

I am trying to change the navigationController push and pop animation like presentModalView and dismissModalView animation.
I am successfully change the push view animation by using the below code. For changing push animation is working fine. This code is shows the view from bottom to top animation(for push view).
CATransition *transition = [CATransition animation];
transition.duration = 0.4f;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
transition.type = kCATransitionMoveIn;
transition.subtype = kCATransitionFromTop;
[self.navigationController.view.layer addAnimation:transition forKey:nil];
[self.navigationController pushViewController:locationObj animated:NO];
But When I am trying to change the pop view animation by using the below code. I am unable to get the top to bottom animation(for pop view).
CATransition *transition = [CATransition animation];
transition.duration = 0.4f;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
[self.navigationController.view.layer addAnimation:transition forKey:nil];
[self.navigationController popViewControllerAnimated:NO];
Please can some one help me.
Tested Code:
CATransition *transition = [CATransition animation];
transition.duration = 0.4f;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
//Pop Animation
transition.type = kCATransitionReveal;
transition.subtype = kCATransitionFromBottom;
[self.navigationController.view.layer addAnimation:transition forKey:nil];
[self.navigationController popViewControllerAnimated:NO];
//Push Animation
//transition.type = kCATransitionMoveIn;
//transition.subtype = kCATransitionFromTop;
//[self.navigationController.view.layer addAnimation:transition forKey:nil];
//[self.navigationController pushViewController:viewControllerToBePushed animated:NO];

Multiple fades in a CATTransition

I'm using a CATransition to create a fade effect on the pushViewControllerAnimated of a UINavigationViewController. This worked out fine with the following code:
CATransition* transition = [CATransition animation];
transition.duration = 0.5;
transition.type = kCATransitionFade;
transition.subtype = kCATransitionFromTop;
[navController.view.layer addAnimation:transition forKey:kCATransition];
[navController popViewControllerAnimated:NO];
[navController pushViewController:nieuweDetailPagina animated:NO];
But because my views are very similar I would like to fade to white in between or show a white flash.
Is it posible to do it in the same transition or do I have to creat a UIView with a white background and start a simultanious animation?
Cheers!

Navigation Controller Custom Direction Not Changing

I am trying to get the navigation controller direction to be kCATransitionFromTop with the CATransition and it is set up to do that however for some reason it is still going from right to left. The fade portion works perfectly. Is there anything that I am doing wrong to have this not work? Do I need to add code in the other view controller? Thanks
- (void)bottomButtonScreen4:(UIGestureRecognizer *)gestureRecognizer {
settingsViewController = [[SettingsViewController alloc] init];
CATransition* transition = [CATransition animation];
transition.duration = 0.5;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionFromTop;
[self.navigationController.view.layer addAnimation:transition forKey:nil];
[self.navigationController pushViewController:settingsViewController animated:YES];
}
The type should be push, and the subtype kCATransitionFromBottom (which actually makes it come in from the top):
CATransition* transition = [CATransition animation];
transition.duration = 0.5;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromBottom;
[self.navigationController.view.layer addAnimation:transition forKey:nil];
[self.navigationController pushViewController:settingsViewController animated:NO];

Resources