RADetailActionsCell+CollectionViewDataSource.m 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // RADetailActionsCell+CollectionViewDataSource.m
  3. // Apex And Drivers
  4. //
  5. // Created by Jack on 2018/6/2.
  6. // Copyright © 2018年 USAI. All rights reserved.
  7. //
  8. #import "RADetailActionsCell+CollectionViewDataSource.h"
  9. #import "RADetailActionModel.h"
  10. @implementation RADetailActionsCell (CollectionViewDataSource)
  11. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  12. return [self actionNumberForSection:section];
  13. }
  14. - (nonnull __kindof UICollectionViewCell *)collectionView:(nonnull UICollectionView *)collectionView cellForItemAtIndexPath:(nonnull NSIndexPath *)indexPath {
  15. RADetailActionSubCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"RADetailActionSubCell" forIndexPath:indexPath];
  16. RADetailActionModel *model = [self actionModelForIndexPath:indexPath];
  17. cell.model = model;
  18. cell.delegate = self;
  19. return cell;
  20. }
  21. #pragma mark - Action Delegate
  22. - (void)actionSubCell:(RADetailActionSubCell *)cell didClickForModel:(RADetailActionModel *)model {
  23. if (self.delegate && [self.delegate respondsToSelector:@selector(actionsCell:didClickSubCell:forModel:)]) {
  24. [self.delegate actionsCell:self didClickSubCell:cell forModel:model];
  25. }
  26. }
  27. @end