Мои UICollectionViewHeaders иногда не отображаются, но ТОЛЬКО при распространении через iTunes Connect - PullRequest
0 голосов
/ 26 июня 2019

Я распространяю приложение через iTunes, и по какой-то причине фактически отображается только половина заголовков в моих представлениях UICollection. Все они прекрасно отображаются в XCode Sim, и даже когда я локально устанавливаю их на своем телефоне со своего ноутбука, они выглядят отлично. Когда я отправляю тот же самый точный код и пытаюсь протестировать через TestFlight, половина заголовков просто не отображается.

Я все перепробовал.

Удаление некоторых представлений коллекции, чтобы увидеть, существует ли какая-либо ошибка перекрестного просмотра. Не повезло.

Копирование и вставка кода, где заголовки отображаются в новых контроллерах, но они все еще не отображаются. Не повезло

Создан новый контроллер практически без функциональности, чтобы увидеть, есть ли какая-то ошибка в функциях. Не повезло

Вот супер базовые контроллеры, которые я создал, чтобы попытаться просто показать заголовки.

Источник тестовых данных:

import LBTAComponents

class TestDatasource: Datasource {

    let testComponents = ["Test 1", "Test 2"]

    override func headerClasses() -> [DatasourceCell.Type]? {
        return[TestHeader.self]
    }

    override func cellClasses() -> [DatasourceCell.Type] {
        return[TestCell.self]
    }

    override func footerClasses() -> [DatasourceCell.Type]? {
        return[TestFooter.self]
    }

    override func item(_ indexPath: IndexPath) -> Any? {
        return testComponents[indexPath.row]
    }

    override func numberOfItems(_ section: Int) -> Int {
        return testComponents.count
    }
}

TestDatasourtce Controller:

import LBTAComponents

class TestDatasourceController: DatasourceController {

    override func viewDidLoad() {
        super.viewDidLoad()
        collectionView?.backgroundColor = UIColor(r: 232, g: 236, b: 241)

        let testDatasource = TestDatasource()
        self.datasource = testDatasource

    }

    override func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
        return CGSize(width: view.frame.width, height: 50)
    }

    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
        return CGSize(width: view.frame.width, height: 100)
    }

    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {
        return CGSize(width: view.frame.width, height: 50)
    }

}

Просмотров: 1019 * *

class TestHeader: DatasourceCell {

    let profileLabel: UILabel = {
        let label = UILabel()
        label.text = "TEST HEADER"
        label.font = UIFont.boldSystemFont(ofSize: 20)
        label.textColor = .white
        return label
    }()

    override func setupViews() {
        super.setupViews()
        backgroundColor = welbyBlueDark
        addSubview(profileLabel)

        profileLabel.anchor(topAnchor, left: leftAnchor, bottom: bottomAnchor, right: rightAnchor, topConstant: 0, leftConstant: 12, bottomConstant: 0, rightConstant: 0, widthConstant: 0, heightConstant: 0)
    }
}


class TestCell: DatasourceCell {

    override var datasourceItem: Any? {
        didSet {
            titleLabel.text = datasourceItem as? String
        }
    }

    let titleLabel: UILabel = {
        let label = UILabel()
        return label
    }()

    override func setupViews() {
        super.setupViews()
        separatorLineView.isHidden = false
        separatorLineView.backgroundColor = welbyBlueLight

        addSubview(titleLabel)

        titleLabel.anchor(topAnchor, left: leftAnchor, bottom: bottomAnchor, right: rightAnchor, topConstant: 0, leftConstant: 12, bottomConstant: 0, rightConstant: 0, widthConstant: 0, heightConstant: 0)

    }
}


class TestFooter: DatasourceCell {

    let profileLabel: UILabel = {
        let label = UILabel()
        label.text = "TEST FOOTER"
        label.font = UIFont.boldSystemFont(ofSize: 20)
        label.textColor = .white
        return label
    }()

    override func setupViews() {
        super.setupViews()
        backgroundColor = welbyBlueDark
        addSubview(profileLabel)

        profileLabel.anchor(topAnchor, left: leftAnchor, bottom: bottomAnchor, right: rightAnchor, topConstant: 0, leftConstant: 12, bottomConstant: 0, rightConstant: 0, widthConstant: 0, heightConstant: 0)
    }
}
...