CollCell.m 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // CollCell.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2018/1/18.
  6. // Copyright © 2018年 罗云飞. All rights reserved.
  7. //
  8. #import "CollCell.h"
  9. @implementation CollCell
  10. - (id)initWithFrame:(CGRect)frame
  11. {
  12. self = [super initWithFrame:frame];
  13. if (self) {
  14. _type = [UILabel new];
  15. _type.textAlignment = NSTextAlignmentCenter;
  16. _type.font = NewFont(fitScreenWidth(12));
  17. [self.contentView addSubview:_type];
  18. _type.sd_layout
  19. .leftSpaceToView(self.contentView, 5)
  20. .topSpaceToView(self.contentView, 10)
  21. .heightIs(20)
  22. .rightSpaceToView(self.contentView, 5);
  23. }
  24. return self;
  25. }
  26. -(void)SetCollCellData:(NSDictionary *)model {
  27. _type.text = model[@"name"];
  28. if ([model[@"state"] isEqualToString:@"0"]) {
  29. _type.textColor = NewButtonColor;
  30. _type.backgroundColor = NewWhiteColor;
  31. ViewBorderRadius(_type, 5, 0.6, NewButtonColor);
  32. }else{
  33. _type.textColor = NewWhiteColor;
  34. _type.backgroundColor = NewButtonColor;
  35. ViewBorderRadius(_type, 5, 0.6, NewButtonColor);
  36. }
  37. }
  38. @end