//自定义一个NaVIgationBar
[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
//消除阴影
self.navigationController.navigationBar.shadowImage = [UIImage new];
可以在BaseNavigationController
#import "BaseNavigationController.h"
@interface BaseNavigationController ()
@property (nonatomic,strong) UIImage * oldShadoImg;
@property (nonatomic,strong) UIImage * clearImage;
@end
@implementation BaseNavigationController
- (UIImage *)clearImage{
if (_clearImage == nil) {
_clearImage = [UIImage new];
}
return _clearImage;
}
- (void)viewDidLoad{
[super viewDidLoad];
self.oldShadoImg = self.navigationBar.shadowImage;
}
- (void)HiddenNavBarLine:(BOOL)isHidden{
if (isHidden) {
[self.navigationBar setBackgroundImage:self.clearImage forBarMetrics:UIBarMetricsDefault];
self.navigationBar.shadowImage = self.clearImage;
}else{
[self.navigationBar setBackgroundImage:self.oldShadoImg forBarMetrics:UIBarMetricsDefault];
self.navigationBar.shadowImage = self.oldShadoImg;
}
}
@end