美文网首页代码片段
iOS 13 tabbar背景透明化和去掉分割线

iOS 13 tabbar背景透明化和去掉分割线

作者: WenJim | 来源:发表于2019-11-06 16:04 被阅读0次

configureWithTransparentBackground 需要放在设置好颜色的后面

 if (@available(iOS 13, *)) {
        UITabBarAppearance *appearance = [self.tabBar.standardAppearance copy];
        appearance.backgroundImage = [UIImage imageWithColor:[UIColor clearColor]];
        appearance.shadowImage = [UIImage imageWithColor:[UIColor clearColor]];
         // 官方文档写的是 重置背景和阴影为透明
        [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/umwubctx.html