去掉UINavigationBar下面黑线的方法

1、遍历找到那条黑线然后隐藏

UIImageView*_lineVIew;

- (void)viewDidLoad {

[superviewDidLoad];

_lineVIew = [selffindlineviw:self.navigationController.navigationBar];

}

-(UIImageView*)findlineviw:(UIView*)view{if([view isKindOfClass:[UIImageViewclass]]&&view.bounds.size.height<=1.0) {return(UIImageView*) view;

}for(UIImageView*subview in view.subviews) {UIImageView*lineview = [selffindlineviw:subview];if(lineview) {returnlineview;

}

}returnnil;

}

-(void)viewWillAppear:(BOOL)animated{

[superviewWillAppear:animated];

_lineVIew.hidden=YES;

}

-(void)viewDidAppear:(BOOL)animated{

[superviewDidAppear:animated];

_lineVIew.hidden=YES;

}

-(void)viewWillDisappear:(BOOL)animated{

[superviewWillDisappear:animated];

_lineVIew.hidden=YES;

}

2

- (void)viewDidLoad {

[superviewDidLoad];

[self.navigationController.navigationBarsetBackgroundImage:[UIImagenew]forBarMetrics:UIBarMetricsDefault];

self.navigationController.navigationBar.shadowImage= [UIImage new];

}

你可能感兴趣的:(去掉UINavigationBar下面黑线的方法)