我想改变导航控制器的标题颜色,但我不知道为什么不工作!更改导航控制器的标题颜色! [iPhone SDK]
UILabel *label = [[[UILabel alloc] init] autorelease];
label.textColor = [UIColor yellowColor];
self.navigationItem.titleView = label;
我想改变导航控制器的标题颜色,但我不知道为什么不工作!更改导航控制器的标题颜色! [iPhone SDK]
UILabel *label = [[[UILabel alloc] init] autorelease];
label.textColor = [UIColor yellowColor];
self.navigationItem.titleView = label;
我想通了,我的问题:
CGRect frame = CGRectMake(0, 0, 310, 44);
UILabel *label = [[[UILabel alloc] initWithFrame:frame] autorelease];
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont systemFontOfSize:25];
label.textAlignment = UITextAlignmentCenter;
label.textColor = [UIColor brownColor];
self.navigationItem.titleView = label;
label.text = NSLocalizedString(@"YOUR TEXT", @"");
现在怎么可以添加一个标志在我的导航栏上? :D
当分配不是给它的尺寸因此它结束了和0x0的帧的UILabel - 您已加入,你会得到你想要的文字后加入[label sizeToFit];
。
或者当你与initWithFrame:(CGRect)frame
创建它,你可以设置标签的大小,你想改变整个导航栏在它中间的颜色或只是的UILabel?假设你想重新着色整个酒吧,你可以通过设置着色颜色做在Interface Builder,或者您可以使用navigationController.navigationBar.tintColor = UIColor(...)
可能重复[iPhone导航栏标题文字颜色](http://stackoverflow.com/questions/599405/iphone-navigation-bar-title-text-color) – 2013-07-17 13:34:05