iOS7 what is the difference in all these color, "barTintColor, tintColor, backgroundColor, UITextAttributeTextColor"?

joyl1216 picture joyl1216 · Jan 30, 2014 · Viewed 8.3k times · Source

I am totally confused about all these color setting in navigationController in iOS7. Can someone tell me what exact difference are among all these things? I tried to figure out some of them, but not sure whether I am right.

Thank you!

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

Answer

Rigel Networks picture Rigel Networks · Jan 30, 2014

Here are the difference between above :

barTintColor : The tint color to apply to the navigation bar background.

backgroundColor : change the background color of navigationBar

tintColor : The tint color to apply to the navigation items and bar button items.

UITextAttributeTextColor : Key to the text color in a text attributes dictionary.The corresponding value is an instance of UIColor. Available in iOS 5.0 and later.Deprecated in iOS 7.0. It’s an easy fix. Just change UITextAttributeTextColor to NSForegroundColorAttributeName

Here is the more details : https://developer.apple.com/library/ios/documentation/uikit/reference/UINavigationBar_Class/Reference/UINavigationBar.html