0

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?

Jojodmo
  • 23,357
  • 13
  • 65
  • 107
fragle
  • 51
  • 6
  • 1
    Can you call backgroundImageForBarMetrics before you set it to an empty image, cache the result, then call setBackgroundImage and pass that original image back in when you want non-transparent bars? – i_am_jorf Feb 15 '14 at 04:10
  • http://www.appcoda.com/customize-navigation-status-bar-ios-7/ – NANNAV Feb 15 '14 at 05:29
  • jeffamaphone you made a really great suggestion. However, I tried to save the image before I use the code above and I still get only a nil image. Weird. Anyway, thanks for the thought. – fragle Feb 16 '14 at 22:07

2 Answers2

1

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

Community
  • 1
  • 1
lancy
  • 857
  • 6
  • 22
  • Exactly, you should add some code though. What you just said is explained here http://stackoverflow.com/a/15580732/1835155. There's probably a cleaner way but.. it does the job! – jbouaziz Feb 15 '14 at 05:58
0

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];
fragle
  • 51
  • 6