我ViewController
有一个navigationBar
with Promt 并且在它之上我添加了一个自定义图像:
- (void)changeNavBar
{
UIImage *image = [UIImage imageNamed: @"logo_home.png"];
imageView = [[UIImageView alloc] initWithImage:image];
imageView.contentMode = UIViewContentModeLeft;
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"logo_home.png"] forBarMetrics:UIBarMetricsDefault];
imageView.frame = CGRectMake(0, 0, 320, 70);
[self.navigationController.navigationBar insertSubview:imageView atIndex:0];
self.navigationController.navigationBar.backItem.backBarButtonItem.tintColor = [UIColor blackColor];
}
但是当用户单击“发送电子邮件”按钮时,我MFMailComposeViewController
会以模态方式创建并呈现它。
- (IBAction)emailPressed:(id)sender
{
NSString *emailTitle = event.title;
NSString *messageBody = [NSString stringWithFormat:@"%@ - %@", event.title, event.concertUrl.absoluteString];
MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
mc.mailComposeDelegate = self;
NSLog(@"subviews: %d", mc.navigationBar.subviews.count);
[mc setSubject:emailTitle];
[mc setMessageBody:messageBody isHTML:NO];
// Present mail view controller on screen
[self presentModalViewController:mc animated:YES];
}
MFMailComposeViewController
的导航栏在没有提示的情况下自动调整为普通导航栏,但我以前 VC 中的自定义图像不会消失。如何删除它并将标准黑色样式设置为我的 navigationBar ?