简体   繁体   English

从iOS 6的导航背景中删除自定义图像

[英]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. 我有一个我正在呈现的MFMailComposeViewController,我想从navigationBar中清除图像。

On iOS 5, this works fine: 在iOS 5上,这很好用:

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

But on iOS 6, this has no effect. 但是在iOS 6上,这没有任何效果。 How could I do this? 我怎么能这样做?

Thank you! 谢谢!

You jus hide the navigation bar.. 你jus隐藏导航栏..

self.navigationController.navigationBarHidden = YES; self.navigationController.navigationBarHidden = YES;

or 要么

[self.navigationController setNavigationBarHidden:YES animated:animated]; [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

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

which had the effect of causing all navbars to have the bar01. 这会导致所有导航栏都有bar01。 Removing this line made it so that the MFMailComposer navbar was the default color with no need to nil out the image. 删除此行使得MFMailComposer导航栏成为默认颜色,无需删除图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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