iOS Swift - How to change background color of Table View?

前端 未结 6 1510
情书的邮戳
情书的邮戳 2021-01-31 02:46

I have a simple table view, I can change the colors of cells, but when trying to change the color of Table View (Background part) it is not working... I tried it via Storyboard.

6条回答
  •  梦谈多话
    2021-01-31 03:46

    use this code for change tableView color

    override func viewDidLoad() {
            super.viewDidLoad()
    
           // define tableview background color
            self.tableView.backgroundColor = UIColor.clearColor()
    }
    

    for change tableView cell color

    cell.backgroundColor = UIColor.clearColor()
    

提交回复
热议问题