UITableViewCell SHADOW disappear while updating by insertRow, then appear back

Shadow disappear on all cells of this type inside tableView once I do insertRow(at:) or deleteRow(at:) in BatchUpdates. Once animation completed shadow appears back for all cells. Any ideas how to keep shadow while insertRow(at:) animates?


class PlaceholderCell: UITableViewCell {
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        backgroundColor = .white
        selectionStyle = .none
       
        layer.shadowColor = UIColor.black.cgColor
        layer.shadowOffset = CGSize(width: 0, height: 10)
        layer.shadowRadius = 10.0
        layer.shadowOpacity = 0.5
        layer.masksToBounds = false
        clipsToBounds = false
    }
   
    required init?(coder: NSCoder) {
        super.init(coder: coder)
    }
}

I'm experiencing the same thing when deleting a cell.

I had the same problem. Try to replace "layer.masksToBounds = false" to layoutSubviews() cell's method. It solved my problem.

UITableViewCell SHADOW disappear while updating by insertRow, then appear back
 
 
Q