iOS 去掉导航条底部黑线

- (void)viewDidLoad {

[super viewDidLoad];

// Do any additional setup after loading the view from its nib.

//    self.automaticallyAdjustsScrollViewInsets = NO;

UIImageView *imageView = [self findHairlineImageViewUnder:self.navigationController.navigationBar];

imageView.hidden = YES;

}

// 去掉顶部导航栏1px的下划线

- (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;

}

你可能感兴趣的:(iOS 去掉导航条底部黑线)