kevinabraham kevinabraham - 7 months ago 38
Swift Question

How to add image to table view controller

Im trying to add an image as a background behind table view controller with multiple cells,already I'm using an imageView but having an issue where the background doesn't go behind the text but above or below the cells.

enter image description here

My file structure looks like:
enter image description here

Answer

To set overall background image to a UITableView use below code

var backGroundImage: UIImageView = UIImageView(image: UIImage(named:  "backGroundImage.png"))
self.tableView.backgroundView = backGroundImage
Comments