[self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc]init]
forBarMetrics:UIBarMetricsDefault];
[self.navigationController.navigationBar setShadowImage:[[UIImage alloc]init]];
方法二
self.navigationController.navigationBar.clipsToBounds = YES;
导航栏半透明
self.navigationController.navigationBar.translucent = YES;
方法三
-
(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];_imageView.hidden = YES;
}_imageView = [self findHairlineImageViewUnder:self.navigationController.navigationBar];
pragma mark - 隐藏导航栏下的横线
- (UIImageView *)findHairlineImageViewUnder:(UIView *)view {
if ([view isKindOfClass:UIImageView.class] && view.bounds.size.height <= 1.0) {
return (UIImageView *)view;
}
for (UIView *subview in view.subviews) {
UIImageView *imageView = [self findHairlineImageViewUnder:subview];
if (imageView) {
return imageView;
}
}
return nil;
}