тень в UICollectionViewCell - PullRequest
       45

тень в UICollectionViewCell

0 голосов
/ 05 августа 2020

Я пытаюсь создать этот тип тени и границы ячейки, но я не получаю точно такой тип тени. Нужна помощь!

Класс UICollectionViewCell:

class CharacterCell: UICollectionViewCell {
@IBOutlet weak var imageView            : UIImageView!
@IBOutlet weak var checkMarkImageView   : UIImageView!
@IBOutlet weak var shadowLayer   : UIView!

var data: String = "" {
    didSet{
        imageView.image = UIImage(named: data)
        
        shadowLayer.layer.shadowOffset = CGSize(width: 1, height: 1)
        shadowLayer.layer.shadowColor = UIColor.black.cgColor
        shadowLayer.layer.shadowRadius = 10
        shadowLayer.layer.cornerRadius = 30
        shadowLayer.layer.shadowOpacity = 0.8
        contentView.layer.borderColor = UIColor.black.cgColor
        contentView.layer.borderWidth  = 2
        contentView.layer.cornerRadius = 30
    }
}

}

И cellForRow

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
    let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! CharacterCell
    cell.data = images[indexPath.row]
    
    
    return cell
}

МОЙ ВЫХОД:

enter image description here

AND this is What I need:

введите описание изображения здесь

...