在iOS 10之前,我们可以使用
隐藏阴影渐变线self.tabBar.shadowImage = [UIImage new];
但这个解决方案在iOS 10之后无效,有什么想法吗?
答案 0 :(得分:0)
我找到了一个忽略iOS版本的通用解决方案
<强>目标C 强>
BOOL isFound = NO;
for (UIView *view in self.tabBar.subviews) {
for (UIView *v in view.subviews) {
if (v.frame.size.height < 2.0f) {
v.hidden = YES;
isFound = YES;
break;
}
}
if (isFound) {
break;
}
}
答案 1 :(得分:0)
试试这可能会有所帮助。
<强> - &GT;对于目标C
1. [[UITabBar appearance] setBackgroundImage:[[UIImage alloc] init]];
2. [[UITabBar appearance] setShadowImage:[[UIImage alloc] init]];
3. [[UITabBar appearance] setValue:@(YES) forKeyPath:@"_hidesShadow"];
4. [[UITabBar appearance] setShadowImage: nil];
<强> - &GT;对于Swift
1. UITabBar.appearance().shadowImage = UIImage()
2. UITabBar.appearance().backgroundImage = UIImage()
3. UITabBar.setValue(true, forKey: "_hidesShadow")
4. UITabBar.appearance().shadowImage = nil