title: How to programmatically add header on UICollectionView with UICollectionViewLayout
body: <p>I have a <code>UICollectionView</code> in one of my <code>viewcontroller</code>. My collection view uses a subclass of <code>UICollectionViewLayout</code> (custom) to layout the cells. First thing, as soon as I select Layout as Custom in dropdown on Storyboard, option to select supplementary views goes away. </p>
  
  <p>I tried doing that programatically as shown below, but none of the delegate methods are getting called.</p>
  
  <pre><code>- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
  {
      if (kind == UICollectionElementKindSectionHeader) {
  
          UICollectionReusableView *reusableview = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HeaderView" forIndexPath:indexPath];
  
          if (reusableview==nil) {
              reusableview=[[UICollectionReusableView alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
            }
  
          UILabel *label=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
          label.text=[NSString stringWithFormat:@"Recipe Group #%li", indexPath.section + 1];
          [reusableview addSubview:label];
          return reusableview;
        }
      return nil;
    }
  
  - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section {
      CGSize headerSize = CGSizeMake(320, 44);
      return headerSize;
    }
  </code></pre>
  
  <p>In my viewDidLoad Method I have</p>
  
  <pre><code>[self.collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HeaderView"];
  </code></pre>
  
  <p>Can anyone point me where I'm messing up?</p>