19

Can i set the background image from storyboard? I've set background in code:

override func viewDidLoad() {
    super.viewDidLoad()
    self.view.backgroundColor = UIColor(patternImage: UIImage(named: "background.png"))
}
1
  • If adding a UIImageView and setting its image is fine with you than yes, you can. Otherwise I don't think you can do this on the default UIView.
    – Losiowaty
    Sep 4, 2016 at 18:03

1 Answer 1

43

Simple:

Add UIImageView to your Storyboard to the most bottom of your view hierarchy.

.

. enter image description here

1
  • 2
    Or, you can just do self.view.backgroundColor = UIColor(patternImage: UIImage(named: "background.png")) in viewDidLoad. Screw a storyboard. Oct 4, 2019 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.