элементы внутри UICollectionViewCell не выделяются / не выделяются - PullRequest
0 голосов
/ 04 мая 2018

enter image description here

override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        if let cell = collectionView.cellForItem(at: indexPath) {
            cell.contentView.backgroundColor = Colors.lightGrayDivider
        }
    }

    override func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) {
        if let cell = collectionView.cellForItem(at: indexPath) {
            cell.contentView.backgroundColor = .white
        }
    }

    override func collectionView(_ collectionView: UICollectionView, didHighlightItemAt indexPath: IndexPath) {
        if let cell = collectionView.cellForItem(at: indexPath) {
            cell.contentView.backgroundColor = Colors.lightGrayDivider
        }
    }

    override func collectionView(_ collectionView: UICollectionView, didUnhighlightItemAt indexPath: IndexPath) {
        if let cell = collectionView.cellForItem(at: indexPath) {
            cell.contentView.backgroundColor = .white
        }
    }

Проблема: contentView UICollectionView выделяется / выбирается вместе с UILabel, но shadowView(UIView) не выделяется / не выделяется

1 Ответ

0 голосов
/ 04 мая 2018

Вы проверили фон этих элементов? Если они белые, они останутся белыми, пока вид содержимого изменит цвет. Вам нужно убедиться, что они имеют четкий фон, чтобы вы могли видеть цвета представлений контента через их собственный фон.

...