gpt4 book ai didi

ios - UIAppearance 移除 MFMailComposeViewController 的自定义 NavBar 背景

转载 作者:可可西里 更新时间:2023-11-01 04:02:50 26 4
gpt4 key购买 nike

我在我的应用程序的导航 Controller 中有一个自定义导航栏图像,使用 UIAppearance 协议(protocol)设置。但是,当通过应用程序发送邮件时(通过 MFMailComposeViewController),我想要默认的导航栏而不是自定义导航栏。我尝试了这个问题中概述的方法:UIAppearance Remove Custom NavBar Background for UIPopoverController但它没有用。我使用的代码是:

[[UINavigationBar appearanceWhenContainedIn:[MFMailComposeViewController class], nil] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];

但是没有任何效果。我的应用程序是 iOS 6+。这是 MFMailComposeViewController 特有的东西还是我遗漏了什么?

编辑:尝试了其他方法:

MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
mailer.mailComposeDelegate = self;
mailer.navigationBar.barStyle = UIBarStyleBlack;
[self.navigationController presentViewController:mailer animated:YES completion:nil];
[mailer.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];

设置 UIBarStyleBlack 有一些效果,因为“取消”按钮随后变黑,但背景图像仍设置为旧值。

最佳答案

尝试这样的事情:

MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init];
[mail.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];

这应该为这个实例重置背景图像。

关于ios - UIAppearance 移除 MFMailComposeViewController 的自定义 NavBar 背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15098428/

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