去掉导航栏下面的横线,iOS11和iOS11以前的系统的方法不同。
#define KDeviceSystemVersion [UIDevice currentDevice].systemVersion.doubleValue
if(KDeviceSystemVersion>=11.0){
[self.navigationController.navigationBar setShadowImage:[UIImage new]];
}else{
NSArray *list=self.navigationController.navigationBar.subviews;
for (id obj in list) {
UIImageView *imageView=(UIImageView *)obj;
NSArray *list2=imageView.subviews;
for (id obj2 in list2) {
UIImageView *imageView2=(UIImageView *)obj2;
if (imageView2.frame.size.height < 1.0) {
imageView2.hidden=YES;
}
}
}
}