Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managing a transition from a normal NavigationBar to a transparent one

I need to manage the transition between two ViewControllers embedded in a NavigationController that uses the standard, light, blurred layer. All of the ViewControllers in this part of the app looks really good with this blurred layer except for one whereas I want it to fade over to become a completely transparent bar and go back to normal when I pop this ViewController.

Desired behaviour:

enter image description here

I've looked into this a long time but I can't figure out how to accomplish it. Can anyone help me with it? I've looked into this question but I don't quite understand how to implement it.

Thank you!

like image 569
Erik Avatar asked Sep 11 '25 14:09

Erik


1 Answers

Have you looked into UIViewControllerTransitionCoordinator?

Each UIViewController has a transitionCoordinator property you can access to perform tasks that are related to a transition.

From the viewWillAppear/viewWillDisappear methods of the UIViewController doing the transition call the animateAlongsideTransition method of the transitionCoordinator:

id <UIViewControllerTransitionCoordinator> coordinator = [self transitionCoordinator];

[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
    // animate the changes in the navigation bar here
} completion:nil];
like image 190
pNre Avatar answered Sep 13 '25 05:09

pNre