Constantin Suiu Constantin Suiu - 1 year ago 53
Swift Question

clipToBounds doesn't work when swiping cells

I have a custom cell with several labels hidden by default (the user sees all content when clicking on the cell). I'm changing the height of the cell and cell.clipToBounds = true to hide the labels. But this doesn't work for editable cells. When I start swiping the cell to left, the hidden content appears. I noticed that it works if I first expand the cell, collapse and the swipe, but stops working if I swipe another cell.
Any suggestions how to hide it when the cell is swiped?

clipToBounds not working for editable cells


Add the labels to an array.

Set hidden to true:

let labels = [firstLabel, secondLabel, etc.…]
for label in labels {
    label.hidden = true