直接上代码
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
}
}
网友评论