【发布时间】:2012-11-30 14:18:35
【问题描述】:
我的 ViewController 有一个带有 Promt 的 navigationBar,在它之上我添加了一个自定义图像:
- (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 中的自定义图像不会消失。如何删除它并将标准黑色样式设置为我的导航栏?
【问题讨论】:
标签: iphone objective-c ios cocoa-touch uinavigationcontroller