0

Does anyone knows why when overriding push or pop to right to left it shows this black faded line behind the push it self?

Image attached that shows the issue:

enter image description here

This is what I use to push:

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    [super pushViewController:viewController animated:NO];
    if (animated)
    {
        CATransition *transition = [CATransition animation];
        transition.duration = TRANSITION_DURATION;
        transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
        transition.type = kCATransitionPush;
        transition.subtype = kCATransitionFromLeft;
        [self.view.layer addAnimation:transition forKey:nil];
    }
}

This is for pop:

- (UIViewController *)popViewControllerAnimated:(BOOL)animated
{
    if (animated)
    {
        CATransition *transition = [CATransition animation];
        transition.duration = TRANSITION_DURATION;
        transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
        transition.type = kCATransitionPush;
        transition.subtype = kCATransitionFromRight;
        [self.view.layer addAnimation:transition forKey:nil];
    }
    return [super popViewControllerAnimated:NO];
}
ytpm
  • 4,962
  • 6
  • 56
  • 113

2 Answers2

0

Instead of [self.view.layer addAnimation:transition forKey:nil] you should write [self.navigationController.view.layer addAnimation:transition forKey:kCATransition];

DaNLtR
  • 561
  • 5
  • 21
0

I had "self.view.translatesAutoresizingMaskIntoConstraints = NO;" set in some of my view controllers. Removing this line fixed the irregular animation and black screen issues.

Jaywant Khedkar
  • 5,941
  • 2
  • 44
  • 55