The changed cell position of the UITableView changes position after scrolling the table

I have strange things. I apply a shadow shadow to a table cell using:

statsTableCell.layer.shadowColor = UIColor.blackColor().CGColor
statsTableCell.layer.shadowOffset = CGSizeMake(0,1)
statsTableCell.layer.shadowRadius = 3
statsTableCell.layer.shadowOpacity = 0.5

This will apply a drop shadow at the bottom of the table cell. If a cell scrolls at the top of the screen when it returns, I see two shadows. Up and down.

I used the code above in other places of the application on uiviews without the same problems.

I want the shadow to be applied to the bottom of the cell, but cannot decide why this only happens in the cells of the table.

In fact, if a table cell scrolls completely out of sight and then back, it changes the position of the shadow depending on the direction of scrolling. If I scroll down, the shadow will apply to the top, if I scroll up, this applies to the bottom.

+4
1

statsTableCell.layer.masksToBounds=false.

+2

All Articles