gpt4 book ai didi

iphone - iOS - 从 MFMailComposeViewController 中删除 UIImageView

转载 作者:行者123 更新时间:2023-11-28 22:44:24 25 4
gpt4 key购买 nike

我的 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 的导航栏在没有提示的情况下自动调整为正常的 navigationBar,但我以前 VC 中的自定义图像并没有消失。如何删除它并为我的 navigationBar 设置标准的黑色样式?

最佳答案

您已使用 UIAppearance 代理设置背景图像,这将影响应用中的每个导航栏。

改变

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

[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"logo_home.png"] forBarMetrics:UIBarMetricsDefault];

关于iphone - iOS - 从 MFMailComposeViewController 中删除 UIImageView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13646960/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com