Title 1343. Squeeze milk


In OC, everyone must be very familiar with, so in Swift5, how to set the text of the navigation bar title?
Look at OC first.

self.navigationItem.title = @"Home";
    self.navigationController.navigationBar.titleTextAttributes = @{
        NSForegroundColorAttributeName: UIColor.redColor,
        NSFontAttributeName: [UIFont systemFontOfSize:26 weight:UIFontWeightUltraLight]
    [self.navigationController.navigationBar setBackgroundColor:UIColor.systemGray4Color];

SWIFT5 Writing:

self.title = "Homepage"
        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.red,NSAttributedString.Key.font: UIFont.systemFont(ofSize: 25, weight: .ultraLight)]
         self.navigationController?.navigationBar.backgroundColor = UIColor.systemGray4



Related Posts

qt (5.10.0) for Android

2 line code completion level pull -up list box

POJ3006, Dirichlet’s theorem on Arithmetic Progressions, Di Likrey theorem.

Comparison of C/C ++ LOG library

Title 1343. Squeeze milk

Random Posts

kotlin declare variables to remove the question mark (?) Use keyword Lateinit

Springmvc error: org.springframework.web.servlet.dispatcherVlet nohandlerfound

Read the HDFS directory and display the content in the file on the web page

Competition Practice Issue 15: Electronic Society September 2021 Youth Software Programming (graphic) level test papers (level 3) …

Sword refers to OFFER-flip word sequence sequence Hanani