Commit 3e734b05 authored by David黄金龙's avatar David黄金龙

代码 优化

parent f2bf4535
......@@ -20,9 +20,6 @@ class YHTabBarViewController: ESTabBarController {
// NotificationCenter.default.addObserver(self, selector: #selector(hideTabBar), name: BsConstant.BsNotification.tabBarHideNotification, object: nil)
//
// NotificationCenter.default.addObserver(self, selector: #selector(showTabBar), name: BsConstant.BsNotification.tabBarShowNotification, object: nil)
}
}
......@@ -37,28 +34,22 @@ extension YHTabBarViewController {
}
extension YHTabBarViewController {
//
//展示tabbar上的横线
func handleTabBarLine() -> Void {
let rect = CGRect.init(x:0,y:0,width:KScreenWidth,height:1)
UIGraphicsBeginImageContext(rect.size)
let context = UIGraphicsGetCurrentContext()
let fillColor = YHColorWithHex(0xeeeeee)
context!.setFillColor(fillColor.cgColor)
context!.fill(rect)
let img = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
let rect = CGRect.init(x:0,y:0,width:KScreenWidth,height:0.5)
let fillColor = YHColorWithHex(0x888888)
let img = UIImage.from(color: fillColor, rect: rect)
UIView.transition(with:self.tabBar, duration:0.5, options: .transitionCrossDissolve) {
if #available(iOS 13.0, *) {
let appearance = self.tabBar.standardAppearance.copy()
appearance.backgroundImage = UIImage.init()
appearance.backgroundImage = UIImage()
appearance.shadowImage = img
self.tabBar.standardAppearance = appearance
}
else{
self.tabBar.backgroundImage = UIImage.init()
self.tabBar.backgroundImage = UIImage()
self.tabBar.shadowImage = img
}
} completion: { Bool in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment