0

我想返回一个部分的标题,而不是另一个部分。

我要返回什么?

-(UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{

    if (indexPath.section == RDSectionRecipeDetail) {
        /*create view here*/
        return myView
    }else{
        //What to return when I dont want a view?
        return ?;
    }
}
4

1 回答 1

1

这是我目前的做法

   - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView   viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
   {
         UICollectionReusableView *headerView = nil;
         headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"collectionHeader" forIndexPath:indexPath];
      if (kind == UICollectionElementKindSectionHeader && indexPath.section != 0) {
            headerView.hidden = YES;
        }
     else{
            headerView.hidden = NO;
         }
         return headerView;
     }
于 2013-11-07T20:11:19.780 回答