Skip to content

Instantly share code, notes, and snippets.

@DonMag
Created October 9, 2015 14:05
Show Gist options
  • Save DonMag/c2adcfa9b958787db2af to your computer and use it in GitHub Desktop.
Save DonMag/c2adcfa9b958787db2af to your computer and use it in GitHub Desktop.
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var myNavBar: UINavigationBar!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 40, height: 40))
imageView.contentMode = .ScaleAspectFit
let image = UIImage(named: "myimage.png")
imageView.image = image
myNavBar.topItem?.titleView = imageView
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment