使用动画更改UICollectionReusableView的标题高度

4
我有一个带有标题的collectionView, 标题的初始大小是X,我想通过动画将其更改为x+50。 但是当我更改标题框架时,它只是覆盖在视图单元上。
    HeaderCollectionView *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:KCollectionHeaderIdentifier forIndexPath:indexPath];
    headerView.frame = CGRectMake(headerView.frame.origin.x, headerView.frame.origin.y, headerView.frame.size.width, self.h);

有时候self.h的大小会不同;感谢。

你找到解决方案了吗?因为我正试图做完全相同的事情。 - Jonauz
1个回答

4

在中更改标题大小

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section

当您想要更改标题大小时,请调用reloadData委托方法。
希望这可以帮助您。

该方法在UICollectionViewDelegateFlowLayout中定义。 - mdziadkowiec

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接