VLCPlaybackInfoCollectionViewDataSource.m 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. /*****************************************************************************
  2. * VLC for iOS
  3. *****************************************************************************
  4. * Copyright (c) 2015 VideoLAN. All rights reserved.
  5. * $Id$
  6. *
  7. * Authors: Tobias Conradi <videolan # tobias-conradi.de>
  8. *
  9. * Refer to the COPYING file of the official project for license.
  10. *****************************************************************************/
  11. #import "VLCPlaybackInfoCollectionViewDataSource.h"
  12. #import "VLCPlaybackInfoTVCollectionSectionTitleView.h"
  13. @implementation VLCPlaybackInfoCollectionViewDataSource
  14. - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
  15. {
  16. VLCPlaybackInfoTVCollectionSectionTitleView *header = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:[VLCPlaybackInfoTVCollectionSectionTitleView identifier] forIndexPath:indexPath];
  17. BOOL showTitle = [collectionView numberOfItemsInSection:indexPath.section] != 0;
  18. header.titleLabel.text = showTitle ? self.title : nil;
  19. return header;
  20. }
  21. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  22. {
  23. return [collectionView dequeueReusableCellWithReuseIdentifier:self.cellIdentifier forIndexPath:indexPath];
  24. }
  25. @end