Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (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;
- }
- - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section;
- - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
- UICollectionReusableView *header = [siteMapCollection dequeueReusableSupplementaryViewOfKind: UICollectionElementKindSectionHeader withReuseIdentifier: @"headerID" forIndexPath: indexPath];
- NSString *headerText = @"This is my header";
- UIFont *labFont = [UIFont fontWithName: @"HelveticaNeue-CondensedBold" size: 20.0];
- CGSize textSize = [dummyText sizeWithFont: labFont];
- UILabel *headerLabel = [[UILabel alloc] initWithFrame: CGRectMake(0, header.frame.size.height - (textSize.height + 12), header.frame.size.width, textSize.height + 8)];
- [headerLabel setFont: labFont];
- [header addSubview: headerLabel];
- return header;
- }
- func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
- return CGSize(width: collectionView.frame.size.width, height: 250)
- }
Add Comment
Please, Sign In to add comment