2015-06-13 21 views
0

我已将我的导航栏设置为白色或至少尝试过。但是,它似乎并没有显得很白。导航栏颜色看起来不正确

下面是我设置它的代码位。

- (void)viewDidLoad { 
     [super viewDidLoad]; 
     [self addSidebarNavButton]; 

     // Set the navbar 
     [self setEdgesForExtendedLayout:UIRectEdgeNone]; 
     UILabel *nav_titlelbl=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, self.navigationItem.titleView.frame.size.width,40)]; 
     [email protected]""; 
     nav_titlelbl.textAlignment=NSTextAlignmentCenter; 
     UIFont *lblfont=[UIFont fontWithName:@"Futura-Medium" size:20]; 
     [nav_titlelbl setFont:lblfont]; 
     self.navigationItem.titleView=nav_titlelbl; 

     // Set the navbar colour 
     self.navigationController.navigationBar.barTintColor = 
     [UIColor colorWithRed:255.0/255.0f green:255.0/255.0f blue:255.0/255.0f alpha:1.0]; 
     self.navigationController.navigationBar.translucent = YES; 

不幸的是我不能在这里附上导航栏图片,因为我没有所需的10个声望点。但是,如果我可以的话,你会发现有问题的导航栏变成了浅灰色!

+0

你试过'self.navigationController.navigationBar.barTintColor = [UIColor whiteColor]'?如果这不起作用,请尝试设置'.translucent = NO' – dstudeba

+0

是的,你钉了它!这固定了它。 self.navigationController.navigationBar.translucent = NO; – gobob

+0

太好了,这可能是因为背景被透露出来了。我在下面添加了答案,所以问题可以完成。 – dstudeba

回答

0

设置self.navigationController.navigationBar.translucent = NO;您可能会看到视图背景。