iOS 7 UIBarButton后退按钮箭头颜色 [英] iOS 7 UIBarButton back button arrow color

查看:206
本文介绍了iOS 7 UIBarButton后退按钮箭头颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更改后退按钮箭头

I'm trying to change the back button arrow

我目前正在使用以下内容来控制文本大小以及后退按钮上的文本颜色:

I'm currently using the following to control the text size as well as the text color on the back button:

[[UIBarButtonItem appearance] setTitleTextAttributes:
  [NSDictionary dictionaryWithObjectsAndKeys:
    [UIColor whiteColor], UITextAttributeTextColor,
    [UIFont boldSystemFontOfSize:16.0f], UITextAttributeFont,
    [UIColor darkGrayColor], UITextAttributeTextShadowColor,
    [NSValue valueWithCGSize:CGSizeMake(0.0, -1.0)], UITextAttributeTextShadowOffset,
  nil] forState:UIControlStateNormal];

但如果我只想更改后退按钮的箭头颜色,我该怎么办? / p>

but if I want to change only the arrow's color for the back button, what should i do?

推荐答案

更改特定导航控制器的后退按钮V形颜色*:

To change the back button chevron color for a specific navigation controller*:

self.navigationController.navigationBar.tintColor = [UIColor whiteColor];

*如果您使用的应用程序包含多个导航控制器,并且您希望这种V形颜色为适用于每个,您可能希望使用外观代理为每个导航控制器设置后退按钮V形符号,如下所示:

*If you are using an app with more than 1 navigation controller, and you want this chevron color to apply to each, you may want to use the appearance proxy to set the back button chevron for every navigation controller, as follows:

[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];

好的措施,在swift中(感谢Jay Mayu在评论中):

And for good measure, in swift (thanks to Jay Mayu in the comments):

UINavigationBar.appearance().tintColor = UIColor.whiteColor()

这篇关于iOS 7 UIBarButton后退按钮箭头颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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