user1451163 user1451163 - 2 months ago 26
Objective-C Question

Change main title color of navigation in MFMailComposeViewController

I haven't problem for change color of main title of navigation on a normal viewController but on a MFMailComposeViewController, it isn't possible.
I can change colors of buttons (cancel and send), I can set background of navigation bar but not possible to change color of title. I don't want set a new title (apparently, it's not allow by Apple), I just want change the color :'(

Please help me.
Thanks

Answer
NSDictionary *navbarTitleTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
                                            [UIColor whiteColor],UITextAttributeTextColor, 
                                            [UIColor blackColor], UITextAttributeTextShadowColor, 
                                            [NSValue valueWithUIOffset:UIOffsetMake(-1, 0)], UITextAttributeTextShadowOffset, nil];

[[UINavigationBar appearance] setTitleTextAttributes:navbarTitleTextAttributes];

Or

navigationController.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObject:[UIColor yellowColor] forKey:UITextAttributeTextColor];

Hope its work for you..

Comments