Разделители ячеек CollectionView не отображаются при использовании RxSwift
Разделители ячеек CollectionView не отображаются, когда я заполняю представление Collection с помощью RxSwift. Я использую RxDataSources вместо функций класса. Я верю функции drawSeparatorIfNeeded
не вызывается где-нибудь по пути, есть ли обходной путь для этого?
Сборник Просмотр подготовки:
private func prepareCollectionView() {
styler.cellStyle = .card
styler.separatorLineHeight = 3.0
styler.separatorColor = UIColor(hex: "#eeeeee")
styler.shouldHideSeparators = false
collectionView?.backgroundColor = UIColor(hex: "#eeeeee")
collectionView?.register(MDCCollectionViewTextCell.self, forCellWithReuseIdentifier: "eventCell")
collectionView?.translatesAutoresizingMaskIntoConstraints = false
collectionView?.topAnchor.constraint(equalTo: navigationBar.bottomAnchor).isActive = true
collectionView?.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
collectionView?.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
collectionView?.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
collectionView?.layoutIfNeeded()
}
Конфигурация ячейки:
dataSource.configureCell = { _, collectionView, indexPath, model in
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "eventCell", for: indexPath) as! MDCCollectionViewTextCell
cell.textLabel?.text = model
cell.backgroundColor = .white
return cell
}
Связывание клеток:
Observable.just(sections)
.bindTo(collectionView!.rx.items(dataSource: dataSource))
.addDisposableTo(disposeBag)
Изучение CollectionView в Reveal показывает, что разделитель UIImageView имеет высоту 0, но когда я использую ванильные методы DataSource, он работает как положено.