Created
January 29, 2013 03:54
-
-
Save xuyunan/4661667 to your computer and use it in GitHub Desktop.
iOS5以上修改导航条上字体颜色
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSMutableDictionary *titleBarAttributes = [NSMutableDictionary dictionaryWithDictionary: [[UINavigationBar appearance] titleTextAttributes]]; | |
[titleBarAttributes setValue:navBarTitleColor forKey:UITextAttributeTextColor]; | |
[titleBarAttributes setValue:[NSValue valueWithUIOffset:UIOffsetMake(0.f, 0.f)] forKey:UITextAttributeTextShadowOffset]; | |
[[UINavigationBar appearance] setTitleTextAttributes:titleBarAttributes]; | |
[[UINavigationBar appearance] setBackgroundColor:[UIColor clearColor]]; | |
[[UINavigationBar appearance] setTintColor:kNAVIGATIONBAR_BARBUTTON_COLOR]; | |
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys: | |
[UIColor blackColor], | |
UITextAttributeTextColor, | |
[UIColor clearColor], | |
UITextAttributeTextShadowColor, nil]; | |
[[UIBarButtonItem appearance] setTitleTextAttributes: attributes | |
forState: UIControlStateNormal]; | |
NSDictionary *highlightedAttributes = [NSDictionary dictionaryWithObjectsAndKeys: | |
[UIColor blackColor], | |
UITextAttributeTextColor, | |
[UIColor clearColor], | |
UITextAttributeTextShadowColor, nil]; | |
[[UIBarButtonItem appearance] setTitleTextAttributes: highlightedAttributes | |
forState: UIControlStateHighlighted]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment