tableView section headers disappear SWIFT

前端 未结 6 1397
慢半拍i
慢半拍i 2020-12-13 18:01

I have a tableView set up so that when a cell is touched, it expands in height to reveal more information. The tableView has 5 sections.

I have a bug: when a cell e

6条回答
  •  自闭症患者
    2020-12-13 18:38

    Since I'm not at 50 reputation yet, I can't comment on the previous answer, so I apologize for listing this as another answer.

    Returning the ContentView will make the function work but will remove all formatting done to the reuseIdentifier (headerCell)

    headerCell.backgroundColor = UIColor.cyanColor()
    

    This will NOT provide a Cyan color to your headerCell

    To fix this, just add the ".contentView" to your formatting lines

    headerCell.contentView.backgroundColor = UIColor.cyanColor()
    

提交回复
热议问题