So i'm trying to do something very simple, display a .png image in the top navigation bar - as the title for the nav bar. The code I've added to viewDidLoad() is:
let imageView = UIImageView(frame: CGRectMake(0, 0, 80, 18))
imageView.contentMode = .ScaleAspectFit
imageView.image = UIImage(named: "cinevu_name copy.png")
self.navigationItem.titleView = imageView
If I run this in the simulator, it's absolutely fine. Logo shows perfect. As soon as I run this on a device - its just not there. No errors, just doesn't display. I tried building on an iPhone 6 and iPhone 5s and same issue.
But simulator is fine.
Any thoughts?? Thanks
Manage to make it work with this:
// Mark:- Sets image in navigation bar
let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 40, height: 20))
imageView.contentMode = .ScaleAspectFit
let image = UIImage(named: "IMAGE_NAME_HERE")
imageView.image = image
navigationItem.titleView = imageView