Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CATransition black color issue when push right to left

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.

like image 355
iPatel Avatar asked Jul 31 '14 06:07

iPatel


1 Answers

Add in the delegate (didFinishLaunchingWithOptions method) these two lines :

self.window.backgroundColor = [UIColor whiteColor];
self.window.tintColor = [UIColor whiteColor];
like image 161
Lilo Avatar answered Sep 20 '22 13:09

Lilo