设置系统导航时,颜色感觉变浅,并且项目的布局已经完成了的情况下可以给你的导航栏基类里插入一个大小宽高为frame.size.width, frame.size.height+20的底图
话不多说上代码:
<pre>
if([[UIDevicecurrentDevice].systemVersionintegerValue] >9) {
for(UIView* viewinself.navigationBar.subviews) {
if([viewisKindOfClass:NSClassFromString(@"_UIBarBackground")]) {
view.hidden=YES;
view.frame= (CGRect){0,0,0,0};
for(UIView*separatorinview.subviews) {
if([separatorisKindOfClass:[UIImageViewclass]]) {
[separatorsetHidden:YES];
}
}
}
}
}
UIView* alphaView = [[UIViewalloc]initWithFrame:CGRectMake(0,0,self.navigationBar.frame.size.width,self.navigationBar.frame.size.height+20)];
alphaView.alpha=1;
alphaView.backgroundColor=NavBar_Bg_Color;
[self.navigationBarsetBackgroundImage:[[UIImagealloc]init]forBarMetrics:UIBarMetricsCompact];
[self.viewinsertSubview:alphaViewbelowSubview:self.navigationBar];
<pre/>
完成