Is there a way to alter either the color or the alpha of the text that is displayed on the navigationItem? Currently its bright white and I would (if possible) like to knock it back a little so its not so bright. Any 开发者_C百科info would be much appreciated.
- (void)loadView {
[[self navigationItem]setTitle:@"Location List"];
...
...
You need to use setTitleView instead and give it a label - Something like this:
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 30)];
titleLabel.textColor = [UIColor redColor];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.text = @"My Title";
[self.navigationItem setTitleView:titleLabel];
you can place new label there:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/1039-change-font-size-navigation-bar.html
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 30)];
titleLabel.textColor = [UIColor colorWithRed:0.0/255.0 green:77.0/255.0 blue:134.0/255.0 alpha:1.0];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.text = @"Videos";
titleLabel.textAlignment = NSTextAlignmentCenter;
titleLabel.font = [UIFont boldSystemFontOfSize:18];
[self.navigationItem setTitleView:titleLabel];
//VKJ
精彩评论