0

UICollectionElementKindSectionHeaderのサイズを変更しようとしていますが、方法が見つかりませんでした。

誰か助けてくれませんか?

ありがとう!!

4

1 に答える 1

4

UICollectionViewDataSourceプロトコル方式を使用できます。

- (UICollectionReusableView *)collectionView: (UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath  {

   // dequeue your resuable headerview and set your custom frame here...

   return headerView;
}

また、UICollectionViewDelegateFlowLayoutプロトコルを実装している場合は、次の方法を使用して、すでにデキューされているセクションヘッダーのサイズを調整できます。

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

   CGSize headerViewSize = CGSizeMake(300, 40);

   return headerViewSize;
}
于 2013-01-30T13:44:05.820 に答える