简体   繁体   中英

Remove custom image from navigation background for iOS 6

I have a MFMailComposeViewController that I'm presenting and I want to clear the image from the navigationBar.

On iOS 5, this works fine:

[self.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];

But on iOS 6, this has no effect. How could I do this?

Thank you!

You jus hide the navigation bar..

self.navigationController.navigationBarHidden = YES;

or

[self.navigationController setNavigationBarHidden:YES animated:animated];

I'm sorry, I have to answer my own question. I made an error: I had set the UINavigationBar app-wide by doing

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"bar01.png"] forBarMetrics:UIBarMetricsDefault];

which had the effect of causing all navbars to have the bar01. Removing this line made it so that the MFMailComposer navbar was the default color with no need to nil out the image.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM