Closed MuhammadEhsanMirzaei closed 5 years ago
Hi. Have you tried your shadow on Example project?
yes I did
Hi. Have you tried your shadow on Example project?
And what was the result? (:
Try adding a subview on top of any UICollectionReusableView
. Make sure that the subview is not of the same size as UICollectionReusableView
(5-10 points insets). Also make sure that subview clipsToBounds = false
. Then apply your shadow to a subview.
so in which delegate I must add a subView?
You add a subview on supplementary view.
To achieve this you should create your own supplementary view (link)
Then register it:
view.register(DecorationView.self, identifier: SquareMosaicLayoutSectionBacker, kind: SquareMosaicLayoutSectionBacker)
thanks it's worked
Hi, I set shadow for section but doesn't effect on section `func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { switch kind { case SquareMosaicLayoutSectionBacker: let view: UICollectionReusableView = collectionView.dequeueSupplementary(kind, indexPath: indexPath, kind: kind) view.layer.backgroundColor = UIColor.white.cgColor view.layer.roundedAllCorner(width: 5, height: 5) view.layer.borderColor = UIColor.clear.cgColor view.layer.shadowColor = UIColor.lightGray.cgColor view.layer.shadowOffset = CGSize(width: 13, height: 13) view.layer.shadowOpacity = 15 view.layer.shadowRadius = 12 view.layer.masksToBounds = false view.masksToBounds = false return view case SquareMosaicLayoutSectionHeader: let view: UICollectionReusableView = collectionView.dequeueSupplementary(kind, indexPath: indexPath, kind: kind) view.layer.backgroundColor = UIColor.clear.cgColor