iOS7所有这些颜色 "barTintColor, tintColor, backgroundColor, UITextAttributeTextColor"有什么区别?

标签 ios7 tintcolor

我对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/

相关文章:

objective-c - iOS 7中UIViewController中NavBar和TabBar下UITableView的边缘延伸以获得半透明效果

core-data - 从 iCloud 中删除核心数据存储

ios - 调用 resignFirstResponder 时,什么会导致间歇性 NSInternalInconsistencyException?

ios - 在 iOS 9 中更改 UITabBarItem 色调颜色?

ios - 更改 UIBarButtonItem 的 Tint 颜色

ios - 如何防止 iOS 使弹出框/警报下方的图像脱色

ios - 自定义搜索栏 searchIcon

ios - adcolony 2.0.1.33 与 ios7 兼容吗?

ios - UIBarButtonItem 色调颜色不起作用

interface-builder - LaunchScreen.xib UINavigationBar & UITableView