有没有办法改变navigationItem上显示的文本的颜色或alpha?目前它的亮白色,我会(如果可能的话)喜欢将它击退一点,所以它不那么明亮。任何信息都将非常感激。
- (void)loadView {
[[self navigationItem]setTitle:@"Location List"];
...
...
答案 0 :(得分:4)
你需要使用setTitleView并给它一个标签 - 像这样:
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];
答案 1 :(得分:1)
你可以在那里放置新标签:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/1039-change-font-size-navigation-bar.html
答案 2 :(得分:0)
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