swift5导航栏标题文字属性设置
生活随笔
收集整理的這篇文章主要介紹了
swift5导航栏标题文字属性设置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
swift5導航欄標題文字屬性設置
在oc里面想必大家都非常熟悉,那么在swift5里面,怎么設置導航欄標題的文字呢.
先看oc。
swift5 寫法:
self.title = "首頁"self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.red,NSAttributedString.Key.font: UIFont.systemFont(ofSize: 25, weight: .ultraLight)]self.navigationController?.navigationBar.backgroundColor = UIColor.systemGray4重點是NSAttributedString.Key.font這個寫法:
總結
以上是生活随笔為你收集整理的swift5导航栏标题文字属性设置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 通过学校区域
- 下一篇: swift5表情键盘项目封装