// // RADetailActionsCell+CollectionViewDataSource.m // Apex And Drivers // // Created by Jack on 2018/6/2. // Copyright © 2018年 USAI. All rights reserved. // #import "RADetailActionsCell+CollectionViewDataSource.h" #import "RADetailActionModel.h" @implementation RADetailActionsCell (CollectionViewDataSource) - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return [self actionNumberForSection:section]; } - (nonnull __kindof UICollectionViewCell *)collectionView:(nonnull UICollectionView *)collectionView cellForItemAtIndexPath:(nonnull NSIndexPath *)indexPath { RADetailActionSubCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"RADetailActionSubCell" forIndexPath:indexPath]; RADetailActionModel *model = [self actionModelForIndexPath:indexPath]; cell.model = model; cell.delegate = self; return cell; } #pragma mark - Action Delegate - (void)actionSubCell:(RADetailActionSubCell *)cell didClickForModel:(RADetailActionModel *)model { if (self.delegate && [self.delegate respondsToSelector:@selector(actionsCell:didClickSubCell:forModel:)]) { [self.delegate actionsCell:self didClickSubCell:cell forModel:model]; } } @end