I'm trying set a cornerRadius
and shadow of an UIImageVIew
that's inside of a UICollectionViewCell
. The problem is that I set clipToBounds = true
and that stops the shadow and the cornerRadius
.
I want to have cornerRadius, clipToBounds and shadow of the images. Not sure what I'd doing wrong here.
class PostPhotoCell: UICollectionViewCell {
@IBOutlet weak var selectedImage: UIImageView!
@IBOutlet weak var deleteButton: UIButton!
override func awakeFromNib()
{
super.awakeFromNib()
selectedImage.layer.cornerRadius = 5.0
selectedImage.contentMode = .scaleAspectFill
//applying overall shadow to image
selectedImage.layer.shadowColor = UIColor(white: 0.0, alpha: 0.5).cgColor
selectedImage.layer.shadowOffset = CGSize(width: 0, height: 0)
selectedImage.layer.shadowOpacity = 1.0
selectedImage.layer.shadowRadius = 6.0
selectedImage.clipsToBounds = true
}
}