更改MFMailComposeViewController navigationBar标题字体 [英] changing the MFMailComposeViewController navigationBar title font

查看:82
本文介绍了更改MFMailComposeViewController navigationBar标题字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 MFMailComposeViewController ,当我设置主题时,它也将它设置为主题。
问题是如何自定义标题和颜色的字体?

I have a MFMailComposeViewController and when I've set the subject it also sets it as the subject. The question is how do I customize the font of the title and color?

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
[picker setSubject:@"Feedback for MyApp"];


推荐答案

我已经改变了我的应用程序的字体所有视图控制器的所有导航栏的app-delegate。如果您不介意更改所有导航栏标题字体,请在 applicationDidFinishLaunching中添加以下内容:withOptions:

i've changed the font generally for my apps from the app-delegate for all navigation bars of all view controllers. if you don't mind it changing all of your navigation bar title fonts, put something like the following in applicationDidFinishLaunching:withOptions:

    if ([[UINavigationBar class] respondsToSelector:@selector(appearance)])
        // set the navigation bar font to "courier-new bold 14"
        [[UINavigationBar appearance] setTitleTextAttributes:
         [NSDictionary dictionaryWithObjectsAndKeys:[UIColor lightGrayColor], UITextAttributeTextShadowColor,
                                                    [NSValue valueWithUIOffset:UIOffsetMake(1, 0)], UITextAttributeTextShadowOffset,
                                                    [UIFont fontWithName:@"CourierNewPS-BoldMT" size:14.0], UITextAttributeFont, 
                                                    nil]];

更新:
如果您想要特定于此例如,您可以使用appearanceWhenContainedIn:使用Alexander Akers在下面的注释中建议的参数,因为UIViewController继承自UIAppearanceContainer。我知道appearanceWhenContainedIn:适用于其他情况,例如UINavigationBar中包含的UIBarButtonItems,因此它应该适用于这种情况。

update: if you want it specific to this one case, you can probably use appearanceWhenContainedIn: using the arguments Alexander Akers suggested in the comment below, since UIViewController inherits from UIAppearanceContainer. i know appearanceWhenContainedIn: works in other cases such as UIBarButtonItems contained in UINavigationBar, so it should work similarly for this situation.

这篇关于更改MFMailComposeViewController navigationBar标题字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆