uinavigationcontroller uinavigationbar 下方横线去除

时间:2022-07-09 07:01:46

#import "QKBaseNavigationController.h"

#define fontSize 19

@interface QKBaseNavigationController ()<UIGestureRecognizerDelegate>

@property (nonatomic, strong) UIImageView * navImageView;

@end

@implementation QKBaseNavigationController

- (void)viewDidLoad {

[super viewDidLoad];

self.navImageView = [self findNavigationBarUnderImageView:self.navigationBar];

//隐藏横线

self.navImageView.hidden = YES;

[self navSetting];

}

- (UIImageView *)findNavigationBarUnderImageView:(UIView *)view {

//判断是否是uinavigationbar 里 imageview

if ([view isKindOfClass:UIImageView.class] && view.bounds.size.height <= 1.0) {

//如果是返回

return (UIImageView *)view;

}

//遍历查找

for (UIView *subview in view.subviews) {

UIImageView *imageView = [self findNavigationBarUnderImageView:subview];

if (imageView) {

//存在就返回

return imageView;

}

}

//不存在返回空

return nil;

}