在UINavigationController中更改后退按钮的默认字体 [英] Change the default font of Back button in UINavigationController

查看:131
本文介绍了在UINavigationController中更改后退按钮的默认字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将UINavigationController中的Back按钮的默认字体更改为自定义字体

I am trying to change the default font of Back button in UINavigationController to a custom font

UIFont *myCustomFont = [UIFont fontWithName:@"MyCustomFont" size:18];

如何将此自定义字体设置为后退按钮?我浏览了本网站中类似问题的其他答案但没有成功。

How can I set this custom font to the Back Button? I've browsed through other answers to similar questions in this site with no success.

推荐答案

[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:
        @{UITextAttributeTextColor:[UIColor blackColor],
         UITextAttributeTextShadowOffset:[NSValue valueWithUIOffset:UIOffsetMake(0, 1)],
         UITextAttributeTextShadowColor:[UIColor whiteColor],
         UITextAttributeFont: myCustomFont
        }
         forState:UIControlStateNormal];

这篇关于在UINavigationController中更改后退按钮的默认字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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