iOS 7 UIBarButton 后退按钮箭头颜色 [英] iOS 7 UIBarButton back button arrow color
问题描述
我正在尝试更改后退按钮箭头
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];
但是如果我只想更改后退按钮的箭头颜色,我该怎么办?
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];
*如果您使用的应用具有 1 个以上导航控制器,并且您希望此 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]];
为了更好的衡量,迅速(感谢评论中的 Jay Mayu):
And for good measure, in swift (thanks to Jay Mayu in the comments):
UINavigationBar.appearance().tintColor = UIColor.whiteColor()
这篇关于iOS 7 UIBarButton 后退按钮箭头颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!