title: How to change the UICollectionView footerview's height programatically
body: <p>I run into an issue that in my UICollectionView, I need to display a footer when the record returned is 0. The codes below seems working good, when there is no record, footer is displayed. However, there is an issue that when there are records, though footer is hidden, code LINE 1 seems do not have any effect, which means the blank space of footer is still there. Any idea how to get rid of it? i.e change the footer'e height to 0 , or just remove the footer when there is record returned.</p>
  
  <pre><code>- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section {
      CGSize footerSize = CGSizeMake(320, self.view.frame.size.height);
      return footerSize;
    }
  
  - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
  {
      UICollectionReusableView *reusableview = nil;
  
      if (kind == UICollectionElementKindSectionFooter) {
          reusableview = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"FooterView" forIndexPath:indexPath];
          reusableview.hidden = YES;
          if([topicArray count]&gt;0){
              reusableview.hidden = YES;
              //reusableview.frame = CGRectMake(0, 0, 0, 0);
              CGRect newFrame = reusableview.frame;
              newFrame.size.height =0;
              reusableview.frame = newFrame; // &lt;-------- LINE 1.
          }else{
              reusableview.hidden = NO;
              reusableview.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
              UIImageView *oopsImgView =[[UIImageView alloc] initWithFrame:CGRectMake(60, 130,200,154)];
             UILabel *label=[[UILabel alloc] ....;
             label.adjustsFontSizeToFitWidth = YES;
             label.textAlignment = NSTextAlignmentCenter;
             label.lineBreakMode = NSLineBreakByWordWrapping;
             label.numberOfLines = 0;
             label.font = [UIFont boldSystemFontOfSize:16.0f];
             label.minimumScaleFactor = 10.0f/15.0f;
             [reusableview addSubview:label];
          }
  
      }
  
      return reusableview;
  }
  </code></pre>