Hi I dont want use UIImageview to add the background image for the UIView. Your suggestion are welcome

+1 vote
39 views
asked May 19 in Swift by anonymous
Hi

   I dont want use UIImageview to add the background image for the UIView. Your suggestion are welcome

2 Answers

0 votes
answered May 19 by admin (8,115 points)
override func viewDidLoad() {
    super.viewDidLoad()
    self.view.backgroundColor = UIColor(patternImage: UIImage(named: "background.png"))
}
0 votes
answered May 19 by admin (8,115 points)
override func viewDidLoad() {

    let backgroundImage = UIImageView(frame: UIScreen.mainScreen().bounds)
    backgroundImage.image = UIImage(named: "bg_image")
    self.view.insertSubview(backgroundImage, atIndex: 0)

}
...