Man*_*rig 22 objective-c ipad ios ios7
我试图改变背景颜色的MFMailComposeViewController在iOS7但我不能使它发挥作用.
我正在使用以下剪辑:
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
if([picker.navigationBar respondsToSelector:@selector(barTintColor)]) {
// iOS7
picker.navigationBar.barTintColor = READER_NAVIGATION_BAR_BACKGROUND_COLOR;
// Set back button arrow color
[picker.navigationBar setTintColor:READER_NAVIGATION_BAR_BACK_BUTTON_ARROW_COLOR];
// Set Navigation Bar Title Color
[picker.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObject:READER_NAVIGATION_BAR_TITLE_NORMAL_FONT_COLOR forKey:UITextAttributeTextColor]];
// Set back button color
[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:READER_NAVIGATION_BAR_BUTTONS_FONT_COLOR, UITextAttributeTextColor,nil] forState:UIControlStateNormal];
}
Run Code Online (Sandbox Code Playgroud)
有谁知道如何改变iOS7中的bakcground颜色MFMailComposeViewController?
Sof*_*ner 69
这里的诀窍是称为"外观方法",如
[UINavigationBar appearance].barTintColor = [UIColor whiteColor];
[UINavigationBar appearance].tintColor = [UIColor redColor];
Run Code Online (Sandbox Code Playgroud)
在打电话之前
[[MFMailComposeViewController alloc] init];
Run Code Online (Sandbox Code Playgroud)
这样,配色方案将应用于邮件编辑器.它可能会返回到默认值mailComposeController:didFinishWithResult:
gau*_*nke 32
试试这个.为我工作.
MFMailComposeViewController* myailViewController = [[MFMailComposeViewController alloc] init];
// set other attributes of mailcomposer here.
myMailViewController.mailComposeDelegate = self;
[myMailViewController.navigationBar setTintColor:[UIColor whiteColor]];
[self presentViewController:myMmailViewController animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
maz*_*ati 17
Swift 3解决方案:
extension MFMailComposeViewController {
override open func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
UIApplication.shared.statusBarStyle = UIStatusBarStyle.lightContent
}
open override func viewDidLoad() {
super.viewDidLoad()
navigationBar.isTranslucent = false
navigationBar.isOpaque = false
navigationBar.barTintColor = UIColor.white
navigationBar.tintColor = UIColor.white
}
}
Run Code Online (Sandbox Code Playgroud)