隐藏导航栏底部一根线

// 注意 viewDidAppear不能用viewWillAppear替代

- (void)viewDidAppear:(BOOL)animated {

    [superviewDidAppear:animated];

    [self findHairlineImageViewUnder:self.navigationController.navigationBar].hidden = YES;

}

- (void)viewWillDisappear:(BOOL)animated {

    [super viewWillDisappear:animated];

    [self findHairlineImageViewUnder:self.navigationController.navigationBar].hidden = NO;

}

#pragma mark - 隐藏导航栏底部一根线

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

        }

    }

    return nil;

}

你可能感兴趣的:(隐藏导航栏底部一根线)