我对iOS7的navigationController中的所有这些颜色设置完全感到困惑。有人可以告诉我所有这些东西之间有什么确切的区别吗?我试图找出其中一些,但不确定我是否正确。
谢谢!
self.navigationController.navigationBar.barTintColor=[UIColor redColor];//???
self.navigationController.navigationBar.backgroundColor=[UIColor greenColor];//???
self.navigationController.navigationBar.tintColor=[UIColor whiteColor];//the text colour of backButton of the navigationBar???
self.navigationController.navigationBar.titleTextAttributes = @{UITextAttributeTextColor:[UIColor blueColor]};//the text color of the title of the navigationBar
[self.navigationItem.rightBarButtonItem setTitleTextAttributes:@{UITextAttributeTextColor:[UIColor greyColor]} forState:UIControlStateNormal];//the text colour of the customised rightButton in the navigationBar
最佳答案
这是上面的区别:
barTintColor:应用于导航栏背景的色调颜色。
backgroundColor:更改navigationBar的背景颜色
tintColor:应用于导航项目和工具栏按钮项目的颜色。
UITextAttributeTextColor:文本属性字典中文本颜色的键。对应的值是UIColor的一个实例。 Available in iOS 5.0 and later.Deprecated in iOS 7.0.
这是easy fix
。只需更改UITextAttributeTextColor to NSForegroundColorAttributeName
这是更多详细信息:https://developer.apple.com/library/ios/documentation/uikit/reference/UINavigationBar_Class/Reference/UINavigationBar.html
关于iOS7所有这些颜色 "barTintColor, tintColor, backgroundColor, UITextAttributeTextColor"有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21447327/