Swift version: 5.2
Each view controller has a
navigationItem property that dictates how it customizes the navigation bar if it is viewed inside a navigation controller. This is where you add left and right bar button items, for example, but also where you can set a title view: any
UIView subclass that is used in place of the title text in the navigation bar.
For example, if you wanted to show an image of your logo rather than just some text you would use this:
navigationItem.titleView = UIImageView(image: UIImage(named: "logo"))
SPONSORED ViRE offers discoverable way of working with regex. It provides really readable regex experience, code complete & cheat sheet, unit tests, powerful replace system, step-by-step search & replace, regex visual scheme, regex history & playground. ViRE is available on Mac & iPad.
Available from iOS 2.0
This is part of the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions.
Link copied to your pasteboard.