美文网首页iOS-Swift
iOS开发 - iOS13隐藏UITabbar分割线

iOS开发 - iOS13隐藏UITabbar分割线

作者: 来者可追文过饰非 | 来源:发表于2019-10-08 13:48 被阅读0次

    直接上代码

       func hideTabbarLine() {
            let rect = CGRect(x: 0, y: 0, width: ScreenWidth, height: ScreenHeight)
            UIGraphicsBeginImageContext(rect.size)
            let context = UIGraphicsGetCurrentContext()
            context?.setFillColor(UIColor.clear.cgColor)
            context?.fill(rect)
            
            let img = UIGraphicsGetImageFromCurrentImageContext()
            UIGraphicsEndImageContext()
            
            if #available (iOS 13.0, *) {
                let appearace = tabBar.standardAppearance.copy()
                appearace.backgroundImage = img
                appearace.shadowColor = .clear
                tabBar.standardAppearance = appearace
            } else {
                tabBar.backgroundImage = img
                tabBar.shadowImage = img
            }
        }
    

    相关文章

      网友评论

        本文标题:iOS开发 - iOS13隐藏UITabbar分割线

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