ShoesCollectionCell.m 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //
  2. // ShoesCollectionCell.m
  3. // Unity-iPhone
  4. //
  5. // Created by duowan123 on 2021/8/31.
  6. //
  7. #import "ShoesCollectionCell.h"
  8. #import "CBPeripheral+ADName.h"
  9. #define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
  10. #define SCALEoefficient(num) (SCREEN_WIDTH/667.0)*(num)
  11. @interface ShoesCollectionCell ()<UIGestureRecognizerDelegate>
  12. @property (weak, nonatomic) IBOutlet UIImageView *imageView;
  13. @property (weak, nonatomic) IBOutlet UILabel *titleStr;
  14. @end
  15. @implementation ShoesCollectionCell
  16. - (void)awakeFromNib{
  17. [super awakeFromNib];
  18. // self.layer.shadowRadius = 6.0f;
  19. // self.layer.shadowColor = [UIColor blackColor].CGColor;
  20. // self.layer.shadowOpacity = 6.0f;
  21. // self.layer.shadowOffset = CGSizeMake(0, 0);
  22. // self.layer.masksToBounds = NO;
  23. self.covierView.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0];
  24. self.covierView.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.16].CGColor;
  25. self.covierView.layer.shadowOffset = CGSizeMake(0,3);
  26. self.covierView.layer.shadowRadius = 6;
  27. self.covierView.layer.shadowOpacity = 1;
  28. self.covierView.layer.cornerRadius = 10;
  29. self.covierView.layer.masksToBounds = YES;
  30. self.covierView.layer.borderColor = [UIColor whiteColor].CGColor;
  31. self.covierView.layer.borderWidth = 3;
  32. self.covierView.backgroundColor = [UIColor whiteColor];
  33. self.covierView.layer.cornerRadius = 15;
  34. self.titleStr.font = [UIFont systemFontOfSize: SCALEoefficient(20)];
  35. //状态label
  36. 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]}];
  37. self.stateLable.attributedText = string;
  38. self.stateLable.textColor = [UIColor colorWithRed:0/255.0 green:220/255.0 blue:66/255.0 alpha:1.0];
  39. //cell添加点击事件
  40. UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(myTableViewClick:)];
  41. [self.contentView addGestureRecognizer:tapGesture];
  42. //
  43. }
  44. #pragma mark - 点击事件
  45. - (void)myTableViewClick:(UIGestureRecognizer *)gestureRecognizer{
  46. if (self.tapGestureBlock){
  47. self.tapGestureBlock(self.model.numberId);
  48. }
  49. }
  50. /**
  51. 加载数据
  52. @param model ShoesPeripheralMolde
  53. */
  54. -(void)setCarouselCellModel:(ShoesPeripheralMolde *)model{
  55. if (self.model!=model){
  56. self.model = model;
  57. }
  58. if (model.peripheral!=nil){
  59. self.titleStr.text = model.peripheral.advertiseName;
  60. }
  61. }
  62. //更新状态
  63. -(void)setCusSelected:(BOOL)cusSelected{
  64. if (cusSelected == YES){
  65. NSLog(@"cusSelected %ld ",(long)self.model.numberId);
  66. self.covierView.layer.masksToBounds = YES;
  67. self.covierView.layer.borderColor = [UIColor colorWithRed:255/255.0 green:196/255.0 blue:0/255.0 alpha:1.0].CGColor;
  68. self.covierView.layer.borderWidth = 3;
  69. self.covierView.backgroundColor = [UIColor colorWithRed:255/255.0 green:245/255.0 blue:210/255.0 alpha:1.0];
  70. self.covierView.layer.cornerRadius = 15;
  71. }else{
  72. self.covierView.layer.masksToBounds = YES;
  73. self.covierView.layer.borderColor = [UIColor whiteColor].CGColor;
  74. self.covierView.layer.borderWidth = 3;
  75. self.covierView.backgroundColor = [UIColor whiteColor];
  76. self.covierView.layer.cornerRadius = 15;
  77. }
  78. }
  79. @end