My navigation bar is transparent, yet now messages app navigation bar is transparent, too

StackOverflow https://stackoverflow.com/questions/21793243

  •  12-10-2022
  •  | 
  •  

Question

I have made the Navigation bar transparent, which is great. Yet, now when I segue to the messages app within my app, the navigation bar is transparent, too, which looks really weird. The messages are blocked only partially and show through the top.

Here's what I did in the appDelegate in order to make the navigation bar disappear:

[[UINavigationBar appearance] setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setShadowImage:[UIImage new]];

As you can imagine, not having the nav bar in the messaging apps is strange. How do I change it back for this view?

Was it helpful?

Solution 2

I was inspired by your answers and here is how I fixed it. First, in the method that calls for the messages app to be displayed, I set the image of the nav bar to nil which takes it back to the default appearance.

[[UINavigationBar appearance] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];

Then in my viewWillAppear method for the view controller that the user goes back to, I simply used this code again

[[UINavigationBar appearance] setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];

OTHER TIPS

You should set that appearance again, before system message VC presenting and after it dismissing. UIAppearance did changed the appearance to all class inside you app, including system-proided VC.

Thanks, jbouaziz. Check out this question:Override UIAppearance property for MFMailComposeViewController

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top