UITableView backgroundColor always white on iPad

后端 未结 16 1595
生来不讨喜
生来不讨喜 2020-12-07 21:35

I\'m working on a project. I have plenty of UITableViews which are set as clear color. Their views\' background color are set to my custom color and everything

16条回答
  •  情深已故
    2020-12-07 22:27

    SWIFT I had this problem too. Works fine on .phone but tableViewCells go white on .pad. Thought I'd show how I fixed it using swift.

    Connect The tableViewCell to the viewController.swift as an @IBOutlet like so:

        @IBOutlet weak var tvc1: UITableViewCell!
        @IBOutlet weak var tvc2: UITableViewCell!
        @IBOutlet weak var tvc3: UITableViewCell!
    

    Then in viewDidLoad put the following:

    tvc1.backgroundColor = tvc1.backgroundColor
    tvc2.backgroundColor = tvc2.backgroundColor
    tvc3.backgroundColor = tvc3.backgroundColor
    

    Very strange, I don't know whats happening here but this solved it for me.

提交回复
热议问题