今天用色码设置UINavigationBar的背景色,怎么设置都是有误差,找了一个小时才发现应该是透明度的原因。加上一句代码搞定
UINavigationBar * customNavigationBar = [[UINavigationBar alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, imageHeight+64)];
customNavigationBar.delegate = self;
customNavigationBar.tag = 300;
[customNavigationBar setBarTintColor:[UIColor colorWithHexString:@"0x183052"]];
//加这句代码
customNavigationBar.translucent = NO;
[self.view addSubview:customNavigationBar];