+1 vote
98 views
asked in Swift by
Hi

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

2 Answers

0 votes
answered by (8.2k points)
override func viewDidLoad() {
    super.viewDidLoad()
    self.view.backgroundColor = UIColor(patternImage: UIImage(named: "background.png"))
}
0 votes
answered by (8.2k points)
override func viewDidLoad() {

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

}

Categories

...