上色UINavigationBar的iOS中
-
11-09-2019 - |
题
予着色橙色我的导航条带:
navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.88 green:0.52 blue:0.27 alpha:1];
一切工作正常,每个按钮是橙色的酒吧,但是当IC卡梅斯为自定义权项的菜单,就说明它的蓝色。 这是截图: http://img146.imageshack.us/img146/5605/schermata20091202a14565 .PNG
和这对右按钮的代码:
UIView *container = [[UIView alloc] init];
UIToolbar *tools = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 80, 45)];
NSMutableArray *buttons = [[NSMutableArray alloc] initWithCapacity:2];
UIBarButtonItem *bi = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addGadget:)];
bi.style = UIBarButtonItemStyleBordered;
[buttons addObject:bi];
[bi release];
bi = [[UIBarButtonItem alloc]
initWithImage:[UIImage imageNamed:@"less.png"] style:UIBarButtonItemStyleBordered target:self action:@selector(setEditing:)];
[buttons addObject:bi];
[bi release];
[tools setItems:buttons animated:NO];
[buttons release];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:tools];
[tools release];
如何让一切成为橙?
解决方案
您应该设置tintColor
对象的UIToolbar
是相同于UINavigationBar
的。
请注意,一个UIToolbar
是不一样的一个UINavigationBar
,背景渐变/颜色是有点不同。尝试设置UIToolbar的backgroundColor至+[UIColor clearColor]
此外,你可能甚至不需要容器UIView
,因为UIToolbar
是UIView
的子类,所以你可以单独使用它作为customView。
不隶属于 StackOverflow