Nik*_*jic 5 uinavigationbar ios swift
UIBarButtonItem.appearance().setTitleTextAttributes() 不适用于 iOS 13。
小智 5
iOS 处理全局外观的方式似乎发生了变化。您需要为 iOS 13 及更高版本添加条件检查,然后添加您的属性,如下所示。
if #available(iOS 13.0, *) {
let standard = UINavigationBarAppearance()
standard.configureWithTransparentBackground()
// TITLE STYLING
standard.titleTextAttributes = [.foregroundColor: UIColor.white, .font: "FONTNAME"]
// NAV BUTTON STYLING
let button = UIBarButtonItemAppearance(style: .plain)
button.normal.titleTextAttributes = [.foregroundColor: .white, .font: "FONTNAME"]
standard.buttonAppearance = button
let done = UIBarButtonItemAppearance(style: .done)
done.normal.titleTextAttributes = [.foregroundColor: .white, .font: "FONTNAME"]
standard.doneButtonAppearance = done
UINavigationBar.appearance().standardAppearance = standard
} else {
// Your previous styling here for 12 and below
}
Run Code Online (Sandbox Code Playgroud)
查看此帖子了解更多信息。我发现它对理解新更新非常有用。
| 归档时间: |
|
| 查看次数: |
1052 次 |
| 最近记录: |