去掉navigationBar下面的一條橫線
1.第一種方法
[[UINavigationBarappearance] setBackgroundImage:[[UIImagealloc] init] forBarPosition:UIBarPositionAnybarMetrics:UIBarMetricsDefault];
[[UINavigationBarappearance] setShadowImage:[[UIImagealloc] init]];
2.第二種方法
@interface BaseViewController (){
UIImageView *navBarHairlineImageView;
}
- (void)viewDidLoad {
[superviewDidLoad];
navBarHairlineImageView = [selffindHairlineImageViewUnder:self.navigationController.navigationBar];
// Do any additional setup after loading the view from its nib.
}
- (UIImageView *)findHairlineImageViewUnder:(UIView *)view {
if ([view isKindOfClass
return (UIImageView *)view;
}
for (UIView *subview in view.subviews) {
UIImageView *imageView = [selffindHairlineImageViewUnder:subview];
if (imageView) {
return imageView;
}
}
returnnil;
}
- (void)viewWillAppear:(
{
[superviewWillAppear:animated];
navBarHairlineImageView.hidden = YES;
}
- (void)viewWillDisappear:(BOOL)animated
{
[superviewWillDisappear:animated];
navBarHairlineImageView.hidden = NO;
}