简体   繁体   中英

Is this code correct for enable large titles?

import UIKit

class GoalViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        navigationController?.navigationBar.prefersLargeTitles = true
        navigationItem.title = "Goal"
        view.backgroundColor = .white
    }

I have ever made Large Titles on this way yet, but now, the VC is completely white, can someone tell me why?

Have you tried this:

navigationItem.largeTitleDisplayMode = .always

You can also use .never for never showing large title or .automatic for inheriting the mode from the previous navigation item

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