Sam
Sam

Reputation: 235

How make UITableView transparent

I am trying several solution like this to make my UITableView transparent

    func tableView(tableView: UITableView, cellForRowAtIndexPath        indexPath: NSIndexPath) -> UITableViewCell {
      tableView.backgroundColor=UIColor.clearColor()
    let cell = tableView.dequeueReusableCellWithIdentifier("signCell", forIndexPath: indexPath) as! SignUpTableViewCell


    cell.backgroundColor=UIColor.clearColor()
    cell.signInfo.text="Mee"

   return cell
}

and I make my text transparent also, but the table and text after that disappear .

Upvotes: 1

Views: 961

Answers (2)

Genesis
Genesis

Reputation: 8158

In some situations, setting tableView.backgroundColor doesn't work and the background of the tableView is always white. I came across this issue when using a UITableView within a custom UIView and solved it with this:

public func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {        
    tableView.backgroundColor = UIColor.clear
}

Upvotes: 0

Pritesh Raiyani
Pritesh Raiyani

Reputation: 313

Try this code in ViewDidLoad

_tableView.backgroundColor = UIColor.clearColor()

Upvotes: 2

Related Questions