iOS 去掉系统导航栏下面的黑色线
[self.navigationController.navigationBar.subviews enumerateObjectsUsingBlock:^(UIView *view, NSUInteger idx, BOOL *stop) {
if (@available(iOS 10.0, *)) {
if (@available(iOS 13.0, *)) {
self.navigationController.navigationBar.subviews[0].subviews[0].hidden = YES;
}else {
self.navigationController.navigationBar.subviews[0].subviews[1].hidden = YES;
}
}else{
//iOS10之前使用的是_UINavigationBarBackground
if ([view isKindOfClass:NSClassFromString(@"_UINavigationBarBackground")]) {
[view.subviews firstObject].hidden = YES;
}
}
}];
网友评论