iOS9 - UITableViewCellContentView is covering up Controls inside Cell

前端 未结 4 1705
生来不讨喜
生来不讨喜 2021-02-02 14:02

I have made a custom UITableViewCell called \"SwitchCell\" that has a switch. In iOS9 Only, using Xcode 7 beta, the Content view in the cell is on top of the switch. (See scre

4条回答
  •  被撕碎了的回忆
    2021-02-02 14:25

    I had this problem when I was reusing a cell as a .xib. I didn't realise but when I first created the xib the default view that it created was in fact a UIView and not a UITableViewCell. It seems that at some stage UIKit adds the content view on top of my other elements and therefore interrupts certain events (e.g. touch events).

    I resolved this by opening my xib file and dragging a UITableViewCell onto the canvas and copying my UI elements from the old view to the new cell.

    Afterwards, additional settings also became available in the attributes inspector that matched those for a UITableViewCell.

提交回复
热议问题