Adding rounded corner and drop shadow to UICollectionViewCell

前端 未结 15 2673
逝去的感伤
逝去的感伤 2020-12-12 09:50

So I already went through various posts on adding 2nd view for adding shadow, but I still cannot get it to work if I want to add it in UICollectionViewCell. I s

15条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-12 10:42

    In case it helps: Here is the swift for rounding the corners:

    cell.layer.cornerRadius = 10
    cell.layer.masksToBounds = true
    

    with cell being a variable controlling the cell: often, you will use this in override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell

    Enjoy!

提交回复
热议问题