daily pastebin goal
84%
SHARE
TWEET

Untitled

a guest Nov 22nd, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView
  2.            viewForSupplementaryElementOfKind:(NSString *)kind
  3.                                  atIndexPath:(NSIndexPath *)indexPath
  4. {
  5.     PhotoVideoHeaderCell *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader
  6.                                                                           withReuseIdentifier:@"videoHeaderView"
  7.                                                                                  forIndexPath:indexPath];
  8.     if (indexPath.section == 0) {
  9.         // photos
  10.         [headerView setSection:@"Photo"];
  11.     } else {
  12.         [headerView.VehicleDetailView removeFromSuperview];
  13.         CGRect frame = headerView.frame;
  14.         frame.size.height = 60;
  15.         [headerView setFrame:frame];
  16.         [headerView setNeedsDisplay];
  17.         [headerView setBackgroundColor:[UIColor grayColor]];
  18.         [headerView setSection:@"Video"];
  19.     }
  20.  
  21.     return headerView;
  22. }
  23.    
  24. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section;
  25.    
  26. - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
  27.     UICollectionReusableView *header = [siteMapCollection dequeueReusableSupplementaryViewOfKind: UICollectionElementKindSectionHeader withReuseIdentifier: @"headerID" forIndexPath: indexPath];
  28.     NSString *headerText = @"This is my header";
  29.     UIFont *labFont = [UIFont fontWithName: @"HelveticaNeue-CondensedBold" size: 20.0];
  30.     CGSize textSize = [dummyText sizeWithFont: labFont];
  31.     UILabel *headerLabel = [[UILabel alloc] initWithFrame: CGRectMake(0, header.frame.size.height - (textSize.height + 12), header.frame.size.width, textSize.height + 8)];
  32.     [headerLabel setFont: labFont];
  33.  
  34.     [header addSubview: headerLabel];
  35.  
  36.     return header;
  37. }
  38.    
  39. func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
  40.     return CGSize(width: collectionView.frame.size.width, height: 250)
  41. }
RAW Paste Data
Top