I want to develop shadow to my collectionViewItem
like this:
How could I achieve this?
I am using a UICollectionView
.
I want to develop shadow to my collectionViewItem
like this:
How could I achieve this?
I am using a UICollectionView
.
add a view to your cell with left, right, top, and bottom constraint of 5 (or whatever).
add put all your cell content in that view
create an outlet for the view
style:
yourView.layer.borderColor = UIColor(red:0, green:0, blue:0, alpha:0.5).cgColor
yourView.layer.shadowOffset = CGSize(width: 0, height: 2)
yourView.layer.shadowColor = UIColor(red:0, green:0, blue:0, alpha:0.5).cgColor
yourView.layer.shadowOpacity = 0.5
yourView.layer.shadowRadius = 3
and if you want rounded corners:
yourView.layer.cornerRadius = 8