美文网首页
iOS 13以后, 无法直接去除tabbar上方的线条, 只能设

iOS 13以后, 无法直接去除tabbar上方的线条, 只能设

作者: sws1314 | 来源:发表于2022-09-09 09:51 被阅读0次

iOS 13以后, 无法直接去除tabbar上方的线条, 只能设置跟tabbar一样的样色,

  /// 修改线条的颜色
- (void)changeShadowImage:(BOOL)isVideo{
    if (@available(iOS 13, *)) {
        UIColor *color = [UIColor whiteColor];
        UITabBarAppearance *appearance = [self.tabBar.standardAppearance copy];
        appearance.backgroundImage = [UIImage qmui_imageWithColor:color];
        appearance.shadowImage = [UIImage qmui_imageWithColor:color];
        // 重置背景和阴影为透明  如果设置了阴影效果则此代码需要去掉
        //        [appearance configureWithTransparentBackground];
        self.tabBar.standardAppearance = appearance;
    } else {
        self.tabBar.backgroundImage = [UIImage new];
        self.tabBar.shadowImage = [UIImage new];
    }
}

相关文章

网友评论

      本文标题:iOS 13以后, 无法直接去除tabbar上方的线条, 只能设

      本文链接:https://www.haomeiwen.com/subject/asvanrtx.html