May be this types of issue occurred with many developer, I also tried to find on Google but there is no luck to solve my problem.
In my app rootViewController
set on window dynamically, I mean user can change root view at run time application. So first I am removing current rootViewController
from UIWindow
and then I set new rootViewController
on UIWindow
with specific animation.
This animation done by CATransition
with transition.type = kCATransitionPush;
.
My app working very well except animation of new rootViewController
. As above I said that I used kCATransitionPush
with CATransition
EDITED: Below is my code:
-(void) changeRootViewController
{
for(UIView *subViews in self.window.rootViewController.view.subviews)
[subViews removeFromSuperview];
[self.window.rootViewController.view removeFromSuperview];
self.window.rootViewController.view = nil;
[self.window.rootViewController removeFromParentViewController];
MainRootViewController *mainRootVC = [[MainRootViewController alloc] init];
CATransition *animation = [CATransition animation];
[animation setDuration:0.4];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromRight];
animation.fillMode = kCAFillModeForwards;
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];
self.window.rootViewController = mainRootVC;
[[self.window layer] addAnimation:animation forKey:nil];
}
I also tried to set clearColor
and whiteColor
of background of UIWindow.
But not working.
My Problem is : While animation is process (right to left) I am getting black shadow. So anybody can help me to hide this black shadow? Please give you golden suggestion.
Thanks.
[animation setDuration:0.0];
I knows this is not better way, but we can't remove that black shadow. – Remind