Нет экземпляра UICollectionViewLayoutAttributes для -layoutAttributesForSupplementaryElementOfKind: UICollectionElementKindSectionHeader в NSIndexPath - PullRequest
0 голосов
/ 08 января 2020

При попытке загрузить элемент дополнительного заголовка для UICollectionView в iOS 10.3, происходит это кра sh. Более того, я получаю еще одну подсказку: Ошибка подтверждения в - [UICollectionViewData layoutAttributesForSupplementaryElementOfKind: atIndexPath:] .

  func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
    if kind == UICollectionView.elementKindSectionHeader {
        let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "ListHeader", for: indexPath) as? ListHeader
        headerView?.updateProductHeader()
        return headerView ?? UICollectionReusableView()
    } else {
        return UICollectionReusableView()
    }
}
...