I am trying to set the height of the section headers for a UICollectionView
dynamically, but using the code below, I am not seeing anything change. The view is drawn with the correct items in it but the height will not budge. Sorry if this is a repeat question, but I can't seem to find anything related specifically to the UICollectionView
object. Thanks in advance.
- (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;
}