Instead of setting uiviewcontroller's modalTransitionStyle, I want to add an CAAnimation(or some other thing). This code can perform an custom animation in navigationController
CATransition* transition = [CATransition animation];
          transition.duration = 0.4;
          transition.type = kCATransitionFade;
          transition.subtype = kCATransitionFromBottom;
          [self.navigationController.view.layer addAnimation:transition forKey:kCATransition];
          [self.navigationController pushViewController:adjustViewController animated:NO];
How can I implement it to a Modal View Controller?
You just need to add the transition to the window's layer, and present your controller rather than pushing it:
     CATransition* transition = [CATransition animation];
     transition.duration = 1;
     transition.type = kCATransitionFade;
     transition.subtype = kCATransitionFromBottom;
     [self.view.window.layer addAnimation:transition forKey:kCATransition];
     [self presentViewController:adjustViewController animated:NO completion:nil];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With