VLCPlaybackInfoCollectionViewDataSource.m 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. - (VLCMediaPlayer *)mediaPlayer
  15. {
  16. return [VLCPlaybackController sharedInstance].mediaPlayer;
  17. }
  18. - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
  19. {
  20. VLCPlaybackInfoTVCollectionSectionTitleView *header = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:[VLCPlaybackInfoTVCollectionSectionTitleView identifier] forIndexPath:indexPath];
  21. BOOL showTitle = [collectionView numberOfItemsInSection:indexPath.section] != 0;
  22. header.titleLabel.text = showTitle ? self.title : nil;
  23. return header;
  24. }
  25. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  26. {
  27. return [collectionView dequeueReusableCellWithReuseIdentifier:self.cellIdentifier forIndexPath:indexPath];
  28. }
  29. @end