NYChartMatrixViewCell.m 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //
  2. // NYChartMatrixViewCell.m
  3. // NYChartDemo
  4. //
  5. // Created by kgj on 2023/3/22.
  6. //
  7. #import "NYChartMatrixViewCell.h"
  8. #define ImageNamed(name) [UIImage imageNamed:name]
  9. @implementation NYChartMatrixViewCell
  10. - (instancetype)initWithFrame:(CGRect)frame{
  11. if(self=[super initWithFrame:frame]){
  12. [self setupUI];
  13. }
  14. return self;
  15. }
  16. - (void)setupUI{
  17. UIView *contentView = self;
  18. UIButton *itemButton = [UIButton buttonWithType:UIButtonTypeCustom];
  19. itemButton.layer.borderWidth = 1.0f;
  20. itemButton.layer.borderColor = UIColorHex(0xD2D1CF).CGColor;
  21. itemButton.titleLabel.font = [UIFont systemFontOfSize:7.f];
  22. [itemButton addTarget:self action:@selector(itemButtonClickdo:) forControlEvents:UIControlEventTouchUpInside];
  23. [contentView addSubview:itemButton];
  24. self.itemButton = itemButton;
  25. [itemButton mas_makeConstraints:^(MASConstraintMaker *make) {
  26. make.edges.equalTo(contentView);
  27. }];
  28. }
  29. - (void)setType:(NSInteger)type
  30. {
  31. [self.itemButton setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
  32. [self.itemButton setTitleColor:UIColor.whiteColor forState:UIControlStateSelected];
  33. [self.itemButton setBackgroundImage:[UIImage imageWithColor:UIColor.whiteColor size:CGSizeMake(100, 100)] forState:UIControlStateNormal];
  34. [self.itemButton setBackgroundImage:[UIImage imageWithColor:UIColorHex(0x3169CE) size:CGSizeMake(100, 100)] forState:UIControlStateSelected];
  35. }
  36. //点击
  37. - (void)itemButtonClickdo:(UIButton*)btn
  38. {
  39. }
  40. @end