self.navigationController.navigationBar.backgroundColor = [[UIColorlightGrayColor] colorWithAlphaComponent:0];
#import <UIKit/UIKit.h>
@interface UINavigationBar (MyBar)
@end
.m
#import "UINavigationBar+MyBar.h"
@implementation UINavigationBar (MyBar)
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
for (UIView * view in self.subviews)
{
if([view isKindOfClass:NSClassFromString(@"_UINavigationBarBackGround")])
{
[view removeFromSuperview];
}
}
}
return self;
}
@end
1.
[[UINavigationBarappearance] setBackgroundImage:[UIImageimageWithPureColorBackgroundImage:[UIColorredColor].CGColorwithSize:CGSizeMake(1,64)] forBarMetrics:UIBarMetricsDefault];
2.
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"systemNavigationBar.png"] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
[[UINavigationBarappearance] setTintColor:[UIColorwhiteColor]]; //导航栏菜单文本颜色