首先创建类指针UIImageView*navBarline;
然后在viewDidLoad添加代码调用查找方法
navBarline= [selffindHairlineImageViewUnder:self.navigationController.navigationBar];
代码附录:
- (void)viewWillDisappear:(BOOL)animated {
[superviewWillDisappear:animated];
navBarline.hidden=NO;
}
- (void)viewWillAppear:(BOOL)animated
{
[superviewWillAppear:animated];
navBarline.hidden=YES;
}
- (UIImageView*)findHairlineImageViewUnder:(UIView*)view {
if([viewisKindOfClass:UIImageView.class] && view.bounds.size.height<=1.0) {
return(UIImageView*)view;
}
for(UIView*subviewinview.subviews) {
UIImageView*imageView = [selffindHairlineImageViewUnder:subview];
if(imageView) {
returnimageView;
}
}
returnnil;
}
代码全部全部完成后就可以运行看看效果了,希望可以帮到各位撸友