I tried a couple of different codes, but could not make the logo display
import UIKit
class HomeViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let logo = UIImage(named: "logo.png")
let imageView = UIImageView(image: logo)
self.navigationItem.titleView = imageView
navigationItem.titleView?.sizeToFit()
}
}
I even tried to include IB in the class itself, it also did not work, it seems that this is not so.
@IBOutlet weak var navBar: UINavigationItem!
PS. My logo is 200x40px png and its name is logo.png in assets.
My storyboard
http://i68.tinypic.com/b68t8o.png
Any help is appreciated
Edit: I solved my problem by putting in its place the entire view of the navigation history. Thanks for your suggestions.
source
share