我有一个CollectionView,它有6个单元格。前4个是看到的,但是用户需要向下滚动才能看到部分。我想要一个阴影,我用红色圆圈显示。
答案 0 :(得分:0)
对于影子你需要做这样的事情
self.layer.shadowPath = UIBezierPath(roundedRect: self.bounds, cornerRadius: self.contentView.layer.cornerRadius).cgPath
答案 1 :(得分:0)
迅速:
像魅力一样工作..
self.collectionView.layer.shadowColor = UIColor.lightGray.cgColor
self.collectionView.layer.shadowOffset = CGSize(width: 0, height: 3)
self.collectionView.layer.shadowOpacity = 0.3
self.collectionView.layer.shadowRadius = 1
self.collectionView.layer.masksToBounds = false
self.collectionView.clipsToBounds = false