123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- //
- // ShoesCollectionCell.m
- // Unity-iPhone
- //
- // Created by duowan123 on 2021/8/31.
- //
- #import "ShoesCollectionCell.h"
- #import "CBPeripheral+ADName.h"
- #define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
- #define SCALEoefficient(num) (SCREEN_WIDTH/667.0)*(num)
- @interface ShoesCollectionCell ()<UIGestureRecognizerDelegate>
- @property (weak, nonatomic) IBOutlet UIImageView *imageView;
- @property (weak, nonatomic) IBOutlet UILabel *titleStr;
- @end
- @implementation ShoesCollectionCell
- - (void)awakeFromNib{
-
- [super awakeFromNib];
-
- // self.layer.shadowRadius = 6.0f;
- // self.layer.shadowColor = [UIColor blackColor].CGColor;
- // self.layer.shadowOpacity = 6.0f;
- // self.layer.shadowOffset = CGSizeMake(0, 0);
- // self.layer.masksToBounds = NO;
-
- self.covierView.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0];
- self.covierView.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.16].CGColor;
- self.covierView.layer.shadowOffset = CGSizeMake(0,3);
- self.covierView.layer.shadowRadius = 6;
- self.covierView.layer.shadowOpacity = 1;
- self.covierView.layer.cornerRadius = 10;
-
- self.covierView.layer.masksToBounds = YES;
- self.covierView.layer.borderColor = [UIColor whiteColor].CGColor;
- self.covierView.layer.borderWidth = 3;
- self.covierView.backgroundColor = [UIColor whiteColor];
- self.covierView.layer.cornerRadius = 15;
-
- self.titleStr.font = [UIFont systemFontOfSize: SCALEoefficient(20)];
-
- //状态label
- NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:@"在线" attributes:@{NSFontAttributeName: [UIFont fontWithName:@"PingFang SC" size: 12], NSForegroundColorAttributeName: [UIColor colorWithRed:0/255.0 green:220/255.0 blue:66/255.0 alpha:1.0]}];
- self.stateLable.attributedText = string;
- self.stateLable.textColor = [UIColor colorWithRed:0/255.0 green:220/255.0 blue:66/255.0 alpha:1.0];
-
- //cell添加点击事件
- UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(myTableViewClick:)];
- [self.contentView addGestureRecognizer:tapGesture];
-
- //
-
- }
- #pragma mark - 点击事件
- - (void)myTableViewClick:(UIGestureRecognizer *)gestureRecognizer{
- if (self.tapGestureBlock){
- self.tapGestureBlock(self.model.numberId);
- }
- }
- /**
- 加载数据
- @param model ShoesPeripheralMolde
- */
- -(void)setCarouselCellModel:(ShoesPeripheralMolde *)model{
-
- if (self.model!=model){
- self.model = model;
- }
- if (model.peripheral!=nil){
- self.titleStr.text = model.peripheral.advertiseName;
- }
-
- }
- //更新状态
- -(void)setCusSelected:(BOOL)cusSelected{
-
- if (cusSelected == YES){
-
- NSLog(@"cusSelected %ld ",(long)self.model.numberId);
- self.covierView.layer.masksToBounds = YES;
- self.covierView.layer.borderColor = [UIColor colorWithRed:255/255.0 green:196/255.0 blue:0/255.0 alpha:1.0].CGColor;
- self.covierView.layer.borderWidth = 3;
- self.covierView.backgroundColor = [UIColor colorWithRed:255/255.0 green:245/255.0 blue:210/255.0 alpha:1.0];
- self.covierView.layer.cornerRadius = 15;
- }else{
-
- self.covierView.layer.masksToBounds = YES;
- self.covierView.layer.borderColor = [UIColor whiteColor].CGColor;
- self.covierView.layer.borderWidth = 3;
- self.covierView.backgroundColor = [UIColor whiteColor];
- self.covierView.layer.cornerRadius = 15;
-
- }
-
- }
- @end
|