Ich habe UICollectionView, in dem die Center-Zelle wie unten gezeigt Bild hervorgehoben wird.UICollectionView markierte Zelle mit Schatten
i verwendet haben folgenden Code Schatten um die Mitte Zelle zu machen.
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell : STSuggestStyleCell = collectionView.dequeueReusableCell(for: indexPath)
if indexPath.row == 4{
cell.imageProfile.layer.cornerRadius = 2.0
cell.imageProfile.layer.borderWidth = 1.0;
cell.imageProfile.layer.borderColor = UIColor.clear.cgColor
cell.imageProfile.layer.masksToBounds = true;
cell.imageProfile.layer.shadowColor = UIColor.lightGray.cgColor;
cell.imageProfile.layer.shadowOffset = CGSize(width: 2.0, height: 2.0);
cell.imageProfile.layer.shadowRadius = 2.0;
cell.imageProfile.layer.shadowOpacity = 2.0;
cell.imageProfile.layer.masksToBounds = false;
cell.imageProfile.layer.shadowPath = UIBezierPath(roundedRect: cell.imageProfile.bounds, cornerRadius: cell.imageProfile.layer.cornerRadius).cgPath
cell.imageProfile.backgroundColor = UIColor.white
}
return cell
}
Aber es funktioniert nicht richtig.
Kann mir jemand sagen, wie man das obige Design mit UICollectionView erreicht?
Ich habe bereits obige Lösung versucht. es funktioniert nicht. –
@ Aman.Sanghani Können Sie den Schatten sehen? Oder der Schatten in der Zelle? –
ja, es hat funktioniert. Vielen Dank:) –