【问题标题】:Change the default font of Back button in UINavigationController更改 UINavigationController 中后退按钮的默认字体
【发布时间】:2014-01-31 18:53:39
【问题描述】:

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

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

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

【问题讨论】:

标签: ios ios7 uinavigationcontroller uikit uinavigationbar


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

【讨论】:

  • 我将此代码放在viewDidAppear 中,但它不起作用。我应该将此代码放在其他地方吗?
  • 拒绝从这里复制粘贴这个答案:stackoverflow.com/questions/16535507/…
  • 已弃用和复制
猜你喜欢
  • 2012-04-19
  • 2012-12-27
  • 1970-01-01
  • 1970-01-01
  • 2017-03-04
  • 2011-05-04
  • 2015-10-11
  • 2012-04-09
  • 1970-01-01
相关资源
最近更新 更多