通过遍历导航栏上的控件找到底部的线 , 控制闲的隐藏与显示
- (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;
}
-(void)viewWillAppear:(BOOL)animated
{
[superviewWillAppear:animated];
_navline.hidden=YES;
}
//在页面消失的时候就让出现
- (void)viewWillDisappear:(BOOL)animated{
[superviewWillDisappear:animated];
_navline.hidden=NO;
}
- (void)viewDidLoad {
[superviewDidLoad];
_navline= [selffindHairlineImageViewUnder:self.navigationController.navigationBar];
}
网友评论