Is this code correct for enable large titles?

31 views Asked by At
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?

1

There are 1 answers

3
perage On

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