更改MFMailComposeViewController的工具栏颜色

iYa*_*sin 19 colors objective-c toolbar ios mfmailcomposeviewcontroller

我在我的iPhone应用程序中使用了一个有色的导航栏和一个有色的全球UIToolbar.在我的信息视图中,我有一个打开MFMailComposeViewController的按钮,该视图顶部的工具栏(带有"取消"和"发送"按钮)仍为蓝色.我正在调用MFMailComposeViewController,如下所示:

-(void)displayMailSheet
{

    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;

    [picker setSubject:@"..."];

    NSArray *toRecipients = [NSArray arrayWithObject:@"..."]; 

    [picker setToRecipients:toRecipients];

    [self presentModalViewController:picker animated:YES];
    [picker release];

}
Run Code Online (Sandbox Code Playgroud)

是否可以更改该视图工具栏的颜色?如果有可能,我该怎么做?

Sin*_*hus 40

干得好:

[[picker navigationBar] setTintColor:[UIColor blackColor]];
Run Code Online (Sandbox Code Playgroud)

对于iOS 8.0

 [[picker navigationBar] setBarTintColor:[UIColor blackColor]];
Run Code Online (Sandbox Code Playgroud)

  • 对于iOS 7.0应用程序,这不起作用.看看eggboxderek的注释. (2认同)

小智 12

关于iOS7下此功能的一个小问题 - 色调颜色属性不再影响整个条形图的颜色,而只是改变了"发送"和"取消"按钮的颜色(在iOS7风格中,它们只是简单的颜色)有色标签).

如果您将标题栏颜色更改为白色或透明,这是值得注意的,因为在iOS7下,发送和取消按钮将不再可见.


Erh*_*rci 5

你可以从appdelegate全局完成

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navigationbar-background.png"] forBarPosition:UIBarPositionTopAttached barMetrics:UIBarMetricsDefault]; // MFMailComposeViewController's navigationBar backgroundcolor 

NSDictionary *textTitleOptions = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor darkGrayColor], UITextAttributeTextColor, [UIColor whiteColor], UITextAttributeTextShadowColor, nil];
[[UINavigationBar appearance] setTitleTextAttributes:textTitleOptions];//MFMailComposeViewController's navigationBar text color 
Run Code Online (Sandbox Code Playgroud)