У меня есть UICollectionReusableView, который я хотел бы показать в заголовке моего collectionView.
Я создал файл XIB для заголовка и перетащил UICollectionReusableView и разместил элементы внутри него, используя автоматическую компоновку. 2 метки внутри повторно используемого представления имеют динамический контент, поступающий с сервера, поэтому их высота варьируется.
Я хотел бы рассчитать динамическую высоту во время выполнения и вернуть ее из:
collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize
Что я заметил, так это то, что высота представления заголовка всегда равна высоте, установленной в файле XIB.