我没有成功尝试过:
MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init]; mailController.navigationBar.translucent = NO;
任何想法 ?
解决方法
默认情况下,MFMailComposeViewController的导航栏将是半透明的,您无法更改.您可以更改的唯一属性是外观代理支持的属性.从苹果文档:
The view hierarchy of this class is private and you must not modify
it. You can,however,customize the appearance of an instance by using
the UIAppearance protocol.
这会让您有限的选项来更改您的MFMailComposeViewController的导航栏外观,因为并不是所有的属性都被支持(例如,如果你尝试像[UINavigationBar外观] setTranslucent:NO];它会崩溃,因为该属性不被代理支持.
以下是Appearance代理支持的属性列表:https://gist.github.com/mattt/5135521
现在,要将MFMailComposeViewController的导航栏设置为非半透明,您需要更改其backgroundColor(它是一个UIView允许的属性,UINavigationBar是UIView的子类):
[[UINavigationBar appearance] setBackgroundColor:[UIColor whiteColor]];
在您实例化MFMailComposeViewController之前,请确保执行此操作,例如:
[[UINavigationBar appearance] setBackgroundColor:[UIColor whiteColor]]; MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
您也可以使用外观WConContainedIn:MFMailComposeViewController,仅当它由MFMailComposeViewController拥有时影响navBar,或者您可以选择将其更改回任何以前在mailComposeController中执行的操作:didFinishWithResult.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。