Я пытаюсь установить высоту заголовков раздела для UICollectionView
динамически, но, используя приведенный ниже код, я ничего не вижу. Вид рисуется с помощью правильных элементов, но высота не сдвинется с места. Извините, если это повторяющийся вопрос, но я не могу найти ничего связанного с объектом UICollectionView
. Спасибо заранее.
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView
viewForSupplementaryElementOfKind:(NSString *)kind
atIndexPath:(NSIndexPath *)indexPath
{
PhotoVideoHeaderCell *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader
withReuseIdentifier:@"videoHeaderView"
forIndexPath:indexPath];
if (indexPath.section == 0) {
// photos
[headerView setSection:@"Photo"];
} else {
[headerView.VehicleDetailView removeFromSuperview];
CGRect frame = headerView.frame;
frame.size.height = 60;
[headerView setFrame:frame];
[headerView setNeedsDisplay];
[headerView setBackgroundColor:[UIColor grayColor]];
[headerView setSection:@"Video"];
}
return headerView;
}