2015-06-13 17 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;您可能會看到視圖背景。