1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- //
- // KDPBannerCell.m
- // KuDianProject
- //
- // Created by 学丽 on 2019/7/4.
- // Copyright © 2019 KDP. All rights reserved.
- //
- #import "KDPBannerCell.h"
- @implementation KDPBannerCell
- -(instancetype)initWithFrame:(CGRect)frame
- {
- self=[super initWithFrame:frame];
- if (self) {
- [self addSubview:self.sdCycleView];
- [self.sdCycleView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(13);
- make.left.mas_equalTo(10);
- make.bottom.mas_equalTo(-10);
- make.right.mas_equalTo(-10);
- }];
- }
- return self;
- }
- -(SDCycleScrollView *)sdCycleView
- {
- if (!_sdCycleView) {
- _sdCycleView =[[SDCycleScrollView alloc]init];
- _sdCycleView.backgroundColor=[UIColor colorWithHexString:LineColor];
- _sdCycleView.delegate=self;
- }
- return _sdCycleView;
- }
- -(void)setBannerArr:(NSArray *)bannerArr
- {
- _bannerArr = bannerArr;
- NSMutableArray *array =[NSMutableArray array];
- for (KDPBannerModel *model in bannerArr) {
- [array addObject:model.img];
- }
- self.sdCycleView.imageURLStringsGroup=array;
- }
- -(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
- {
- if (self.bannerBlock) {
- self.bannerBlock(self.bannerArr[index]);
- }
- }
- @end
|