Reputation: 1427
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.
Upvotes: 1
Views: 1395
Reputation: 309
You need change the property of the background color for Tableview : clear background
Upvotes: 0
Reputation: 1236
To set overall background image to a UITableView use below code
var backGroundImage: UIImageView = UIImageView(image: UIImage(named: "backGroundImage.png"))
self.tableView.backgroundView = backGroundImage
Upvotes: 2
Reputation: 3317
override func viewDidLoad()
{
let img:UIImageView=UIImageView(frame: PostTable.frame)
img.image=UIImage(named: "hi.png")
PostTable.backgroundView=img
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
let cell:UITableViewCell! = tableView.dequeueReusableCellWithIdentifier("cell")
let selectView=UIView()
selectView.backgroundColor=UIColor.clearColor()
cell.selectedBackgroundView=selectView
cell.backgroundColor=UIColor.clearColor()
cell.contentView.backgroundColor=UIColor.clearColor()
return cell!
}
Upvotes: 0