隐藏导航栏分割线

@interfaceGXBlistedcompanyController()

@property(nonatomic,strong)UIImageView*navBarHairlineImageView;

@end

@implementationGXBlistedcompanyController

- (void)viewDidLoad {

     [superviewDidLoad];

    self.navBarHairlineImageView=    [selffindHairlineImageViewUnder:self.navigationController.navigationBar];

}

- (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) {

          return  imageView;

}

}

      return  nil;

}

- (void)viewWillAppear:(BOOL)animated{

      [superviewWillAppear:animated];

      [self.navigationControllersetNavigationBarHidden:NO];

      self.navBarHairlineImageView.hidden=YES;

}

//在页面消失的时候就让navigationbar还原样式

-(void)viewWillDisappear:(BOOL)animated{

      [superviewWillDisappear:animated];

      self.navBarHairlineImageView.hidden=NO;

}

你可能感兴趣的:(隐藏导航栏分割线)