Is there any way to have different barTintColor
of UINavigationController
's UINavigationBar
on different pushed controllers with smooth color transition animation?
I'd like to have a smooth animation of UINavigationBar
's tint color during UINavigationController
's push/pop animation and ideally also interactive pop (gesture based controller pop).
Why do I need this? I'd like to have 1 controller in the navigation stack to have different tint color indicating status of some task (red / green etc.).
What I have tried so far:
viewWillAppear
(view lifecycle) methods, but there is no way to animate thebarTintColor
(likesetBarTintColor:animated:
)- To change
barTintColor
in[UIView animation...]
block, but that just weirdly animates frame of (probably) some background layer instead of smooth color transition. - To change
barTintColor
in[UIView transitionWithView:...]
block withUIViewAnimationOptionTransitionCrossDissolve
, but that does not animate change. Just instantly changes to new tint color after the animation duration - I had an idea of implementing new iOS 7 custom transition calculating and changing color of navbar during progress, but that seems to be big overkill (specially if I want to keep original animation appearance everywhere)
Thank you everyone for any ideas and answers
You can get this by using
UIViewControllerTransitionCoordinator
.AController
and customize the colors.BController
and customize the colors.UINavigationController
's push/pop transition, theAController
's style will smoothly fade in/out toBController
's style.Example code: