Skip to content

Instantly share code, notes, and snippets.

@xyclos
Created January 14, 2016 22:11
Show Gist options
  • Save xyclos/92ea1ac63dd192ab4ba1 to your computer and use it in GitHub Desktop.
Save xyclos/92ea1ac63dd192ab4ba1 to your computer and use it in GitHub Desktop.
Set image as background
import UIKit
class ViewController: UIViewController {
var imageView: UIImageView?
override func viewDidLoad() {
super.viewDidLoad()
let screenSize: CGRect = UIScreen.mainScreen().bounds
if let image = UIImage(named: "autumn.jpg") {
imageView = UIImageView(image: image)
imageView!.frame = screenSize
view.addSubview(imageView!)
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment