寻找下边线View视图
- (UIImageView*)bottomLineView:(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 bottomLineView:subview];
if(imageView) {
return imageView;
}
}
return nil;
}
显示导航栏底部的分隔线
#pragma mark 显示导航栏底部的分隔线
-(void)showBarBottomLine
{
if ([self.navigationController.navigationBar respondsToSelector:@selector( setBackgroundImage:forBarMetrics:)]){
UIImageView *imageView = [self bottomLineView:self.navigationController.navigationBar];
imageView.hidden = NO;
}
}
隐藏导航栏底部的分隔线
- (void)hideBarBottomLine
{
if ([self.navigationController.navigationBar respondsToSelector:@selector( setBackgroundImage:forBarMetrics:)]){
UIImageView *imageView = [self bottomLineView:self.navigationController.navigationBar];
imageView.hidden = YES;
}
}