50 lines
1.5 KiB
Swift
50 lines
1.5 KiB
Swift
//
|
|
// UINavigationBar+FAAdd.swift
|
|
// Fableon
|
|
//
|
|
// Created by 湖北秦九 on 2025/10/9.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
extension UINavigationBarAppearance {
|
|
static func defaultAppearance() -> UINavigationBarAppearance {
|
|
let navBarAppearance = UINavigationBarAppearance()
|
|
navBarAppearance.configureWithOpaqueBackground()
|
|
navBarAppearance.backgroundColor = .clear
|
|
navBarAppearance.backgroundEffect = nil
|
|
navBarAppearance.shadowColor = UIColor.clear
|
|
navBarAppearance.titleTextAttributes = [
|
|
NSAttributedString.Key.font : UIFont.font(ofSize: 18, weight: .bold),
|
|
NSAttributedString.Key.foregroundColor : UIColor.FFFFFF
|
|
]
|
|
return navBarAppearance
|
|
}
|
|
}
|
|
|
|
extension UINavigationBar {
|
|
|
|
|
|
func fa_setTranslucent(isTranslucent: Bool) {
|
|
self.isTranslucent = isTranslucent
|
|
}
|
|
|
|
func fa_setBackgroundColor(backgroundColor: UIColor?) {
|
|
let appearance = self.standardAppearance
|
|
appearance.backgroundColor = backgroundColor
|
|
self.standardAppearance = appearance
|
|
self.scrollEdgeAppearance = appearance
|
|
}
|
|
|
|
func fa_setTitleTextAttributes(titleTextAttributes: [NSAttributedString.Key : Any]?) {
|
|
let appearance = self.standardAppearance
|
|
|
|
if let titleTextAttributes = titleTextAttributes {
|
|
appearance.titleTextAttributes = titleTextAttributes
|
|
}
|
|
self.scrollEdgeAppearance = appearance
|
|
self.standardAppearance = appearance
|
|
|
|
}
|
|
}
|