我在开头创建了一个带有CollectionReusableView的UICollectionView并实现了所需的委托方法:
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section
和
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
通过执行此操作,正确显示了collectionView标头。但是当我将CollectionViewLayout更改为自定义(不是流布局)时,检测到问题,Header View不再显示。 在调试时,我看到没有调用委托方法viewForSupplementaryElementOfKind:atIndexPath:。
注意我使用RFQuiltLayout作为UICollectionView布局。
提前感谢您的帮助