VideoCoverView.m 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // VideoCoverView.m
  3. // BuguLive
  4. //
  5. // Created by 岳克奎 on 17/4/19.
  6. // Copyright © 2017年 xfg. All rights reserved.
  7. //
  8. #import "VideoCoverView.h"
  9. #import "STCollectionPhotoCell.h"
  10. @implementation VideoCoverView
  11. -(instancetype)initWithCoder:(NSCoder *)aDecoder{
  12. if (self = [super initWithCoder:aDecoder]) {
  13. }
  14. return self;
  15. }
  16. -(void)awakeFromNib{
  17. [super awakeFromNib];
  18. [self showRegistCell];
  19. self.selectIndexRow = 0;
  20. }
  21. -(void)showRegistCell{
  22. [self.collectionView registerNib:[UINib nibWithNibName:@"STCollectionPhotoCell" bundle:nil]
  23. forCellWithReuseIdentifier:@"STCollectionPhotoCell"];
  24. }
  25. //STCollectionPhotoCell
  26. #pragma mark -cell
  27. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  28. {
  29. STCollectionPhotoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"STCollectionPhotoCell" forIndexPath:indexPath];
  30. [cell.bgImgView setImage:self.dataSourceMArray[indexPath.row]];
  31. cell.bgImgView.hidden = NO;
  32. if ( self.selectIndexRow == indexPath.row) {
  33. cell.isSelectedState = YES;
  34. }else{
  35. cell.isSelectedState = NO;
  36. }
  37. if (cell.isSelectedState) {
  38. cell.layer.borderWidth = 2;
  39. cell.layer.borderColor = [kAppMainColor CGColor];
  40. }else{
  41. cell.layer.borderWidth = 0;
  42. }
  43. return cell;
  44. }
  45. @end