-1

Possible Duplicate:
iPhone Navigation Bar Title text color

How do I set the title color of the navigation bar through code?

Community
  • 1
  • 1
surendher
  • 1,374
  • 3
  • 26
  • 52
  • 7
    What have you tried thus far? Have you, for starters, looked at the developer documentation for the [UINavigationBar](http://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationBar_Class/Reference/UINavigationBar.html)? – Dan J Jan 05 '12 at 07:12

3 Answers3

2

You need to use a UILabel as the titleView of the navigationItem. Set label background color as clear color and text color as according to your requirement. then set the titleview for navigation item to this label.

self.navigationItem.titleView = label;
vtechig
  • 177
  • 2
0

You can use uinavigationbar's setTitleTextAttributes for setting the font, color, offset, and shadow color. this works for ios 5.

Anand
  • 3,346
  • 9
  • 35
  • 54
0
CGRect frame = CGRectMake(0, 0, 200, 44);
TitleLabel = [[[UILabel alloc] initWithFrame:frame] autorelease];
TitleLabel.backgroundColor = [UIColor clearColor];
TitleLabel.font = [UIFont boldSystemFontOfSize:14.0];
TitleLabel.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.5];
TitleLabel.text = @"Nav Bar Title";
TitleLabel.textAlignment = UITextAlignmentCenter;
TitleLabel.textColor = [UIColor colorWithRed:1 green:2 blue:4 alpha:0.7];
self.navigationItem.titleView = TitleLabel.text;

You can take a UILabel, set its font, color alignment and add it on Navigation bar.
Hope it works for you.
Suraj Mirajkar
  • 1,369
  • 10
  • 23