iOS - 如何在不被前一个单元格覆盖的情况下在 tableView 单元格顶部添加子视图

iOS - How to add subview on top of tableView cell without be covering by the previous Cell

我有一个 tableivew,我想在 tableview 单元格的顶部添加一个标记。这个车标就像一个弹出窗口。 我所做的是取消选中此 tableview 单元格中的 clip to bond,使其正确显示。

但发生的事情是当我滚动时 up/bottom 这个弹出窗口被前面的 tableview 单元格覆盖了。 所以知道如何通过使单元格背景清晰来解决这个问题,因为这些单元格是彩色的。

使用以下方法更改 coachmark 视图的 z 轴距离

bringSubviewToFront(_:)

sendSubviewToBack(_:) on coachmark or others cells

示例:

cell.contentView.bringSubviewToFront(coachmark)