方式一:
self.navigationController.navigationBar.subviews[0].subviews[0].hidden = YES;
方式二:
UIImageView *navBarHairlineImageView = [self findLineImageViewUnder:self.navigationController.navigationBar];
navBarHairlineImageView.hidden = YES;
- (UIImageView *)findLineImageViewUnder:(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 findLineImageViewUnder:subview];
if (imageView) {
return imageView;
}
}
return nil;
}