#define kIOS_VERSION ([[[UIDevice currentDevice] systemVersion] floatValue])
#define IOS8_OR_LATER (kIOS_VERSION >= 8.0)
#define IOS9_OR_LATER (kIOS_VERSION >= 9.0)
#define IOS10_OR_LATER (kIOS_VERSION >= 10.0)
#define IOS12_OR_LATER (kIOS_VERSION >= 12.4)
#define IOS121_OR_LATER (kIOS_VERSION <=13.0)
if (IOS10_OR_LATER) {
[self.tabBar.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:NSClassFromString(@"_UIBarBackground")]) {
[obj.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj1, NSUInteger idx1, BOOL * _Nonnull stop1) {
if ([obj1 isKindOfClass:NSClassFromString(@"_UIBarBackgroundShadowView")]) {
obj1.hidden = YES;
*stop = YES;
}else if (obj1.frame.size.height < 1){
obj1.hidden = YES;
*stop = YES;
}
}];
*stop = YES;
}
}];
} else {
[self.tabBar.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:[UIImageView class]] && ![obj isKindOfClass:NSClassFromString(@"_UITabBarBackgroundView")]) {
obj.hidden = YES;
*stop = YES;
}
}];
}
[iOS开发]隐藏Tabbar顶部黑线
最新推荐文章于 2023-07-11 21:34:34 发布