I\'ve been trying to create a custom tableview cell with rounded corners and drop shadow, I managed to create the rounded corners but the shadow is showing only on the corners a
For both the shadow and the rounded corners, you can use this code:
override func tableView(_ tableView: UICollectionView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath)
cell.layer.cornerRadius = 10
let shadowPath2 = UIBezierPath(rect: cell.bounds)
cell.layer.masksToBounds = false
cell.layer.shadowColor = UIColor.black.cgColor
cell.layer.shadowOffset = CGSize(width: CGFloat(1.0), height: CGFloat(3.0))
cell.layer.shadowOpacity = 0.5
cell.layer.shadowPath = shadowPath2.cgPath
return cell
}
And you can adjust the values and you'll get the perfect shadow for you!
Hope it helps!