1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- //
- // RQCommonBannerADCell.m
- // NiuBi
- //
- // Created by 张嵘 on 2023/2/20.
- //
- #import "RQCommonBannerADCell.h"
- @interface RQCommonBannerADCell () <SDCycleScrollViewDelegate>
- @property (nonatomic, readwrite, strong) RQCommonBannerADItemViewModel *viewModel;
- @property (nonatomic, readwrite, strong) SDCycleScrollView *sdcycleScrollView;
- @end
- @implementation RQCommonBannerADCell
- + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
- static NSString *ID = @"RQCommonBannerADCell";
- [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
- RQCommonBannerADCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
- if (!cell) cell = [self rq_viewFromXib];
- return cell;
- }
- - (void)bindViewModel:(RQCommonBannerADItemViewModel *)viewModel {
- _viewModel = viewModel;
- }
- - (void)awakeFromNib {
- [super awakeFromNib];
- [self.contentView addSubview:self.sdcycleScrollView];
- }
- #pragma mark - SDCycleScrollViewDelegate
- - (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
-
- }
- - (SDCycleScrollView *)sdcycleScrollView {
- if (!_sdcycleScrollView) {
- _sdcycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, (RQ_SCREEN_WIDTH - 32.f), (RQ_SCREEN_WIDTH - 32.f) * (95.f / 345.f)) imageNamesGroup:@[@"RQ-AD",@"banner0",@"banner1",@"banner2"]];
- _sdcycleScrollView.autoScrollTimeInterval = 5;
- _sdcycleScrollView.placeholderImage = RQImageNamed(@"未开发");
- _sdcycleScrollView.layer.cornerRadius = 10;
- _sdcycleScrollView.clipsToBounds = YES;
- _sdcycleScrollView.delegate = self;
- }
- return _sdcycleScrollView;
- }
- @end
|