I have a UITabViewController
which embeds some UIViewControllers
. These controllers could have a different preferredStatusBarStyle
.
I use a UIViewControllerAnimatedTransitioning+UIPercentDrivenInteractiveTransition
to switch between controllers using a UIScreenEdgePanGestureRecognizer
.
I noticed that if i start a transitioning between two controllers with different preferredStatusBarStyle
and i cancel the transitioning, the status bar style does not return to the first controller preference but it remains to the second one. Obviously if i complete the transitioning, or switch between controllers using the tab bar items, the status bar style changes correctly.
I tried to call setNeedsStatusBarAppearanceUpdate()
in every viewWillAppear
, but the status bar does not change.
I know i can change the status bar style with UIApplication.shared.statusBarStyle
setter, but this method is now deprecated.
I also tried to change the animation for the transitions, but the problem does not disappear.
The strange thing is that the preferredStatusBarStyle
of the "from" view controller, when the transition is canceled, is set to the correct value, but it is displayed as the opposite!