MoviaBox/ShortPlay/AppDelegate/AppDelegate+Config.swift

76 lines
2.2 KiB
Swift

//
// AppDelegate+Config.swift
// ShortPlay
//
// Created by on 2025/4/8.
//
import UIKit
extension AppDelegate {
func appConfig() {
// UIView.et_Awake()
tabBarConfig()
// keyBoardStyle()
SPToast.config()
}
}
extension AppDelegate {
///tabBar
private func tabBarConfig() {
let tabBar = UITabBar.appearance();
let font = UIFont.fontRegular(ofSize: 10)
let normalColor = UIColor.color7F7F80()
let selectedColor = UIColor.colorFF0089()
let backgroundImage = UIImage(color: .clear)
let backgroundColor = UIColor.clear
let shadowImage = UIImage()
let shadowColor = UIColor.clear
let par = NSMutableParagraphStyle()
par.alignment = .center;
let normalAttributes = [NSAttributedString.Key.foregroundColor : normalColor,
NSAttributedString.Key.paragraphStyle : par,
NSAttributedString.Key.font: font,
]
let selectedAttributes = [NSAttributedString.Key.foregroundColor:selectedColor,
NSAttributedString.Key.paragraphStyle : par,
NSAttributedString.Key.font: font,
]
let appearance = UITabBarAppearance()
let normal = appearance.stackedLayoutAppearance.normal
normal.titleTextAttributes = normalAttributes
let selected = appearance.stackedLayoutAppearance.selected
selected.titleTextAttributes = selectedAttributes
appearance.backgroundImage = backgroundImage;
appearance.backgroundColor = backgroundColor;
appearance.shadowImage = shadowImage
appearance.shadowColor = shadowColor
appearance.backgroundEffect = nil
//
// appearance.configureWithTransparentBackground()
tabBar.standardAppearance = appearance;
if #available(iOS 15.0, *) {
tabBar.scrollEdgeAppearance = appearance
}
}
}