简体   繁体   中英

Cannot set custom large title in NavigationBar

It seems I can only change the large title when using no font. I can't change the title property when using a custom font.

  navigationItem.title = “title”

How can I change the large title when using custom font instead of system font?

In the viewDidLoad of your controller just put this code with your specific values of font and color. It will show normal and large title with respective title attributes.

navigationItem.largeTitleDisplayMode = .always
navigationItem.title = "Your Title"

navigationController?.navigationBar.titleTextAttributes = [
    NSAttributedString.Key.font: Font.medium(15),
    NSAttributedString.Key.foregroundColor: Color.black
]

navigationController?.navigationBar.largeTitleTextAttributes = [
    NSAttributedString.Key.font: Font.medium(25),
    NSAttributedString.Key.foregroundColor: Color.black
]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM