Adding background to ios app in xcode 6 using Swift
16,221
Solution 1
If you want to do it programmatically using swift here is the code:
self.view.backgroundColor = UIColor(patternImage: UIImage(named: "yourImage.png"))
Or you can create a uiimage and place your image in it:
let yourImage = UIImage(named: "yourImage.png")
let imageview = UIImageView(image: yourImage)
self.view.addSubview(imageview)
Solution 2
Add a UIImageView to your view controller's view. Assign your background image to the image view. You can do all this in the storyboard file.
Good luck!
Author by
user3411711
Updated on June 05, 2022Comments
-
user3411711 almost 2 years
I am new to ios development so please forgive me. I am taking it step by step and I was wondering how would I make a image I want to be the background in the view controller so I can add on top of it?