// // NYChartMatrixViewCell.m // NYChartDemo // // Created by kgj on 2023/3/22. // #import "NYChartMatrixViewCell.h" #define ImageNamed(name) [UIImage imageNamed:name] @implementation NYChartMatrixViewCell - (instancetype)initWithFrame:(CGRect)frame{ if(self=[super initWithFrame:frame]){ [self setupUI]; } return self; } - (void)setupUI{ UIView *contentView = self; UIButton *itemButton = [UIButton buttonWithType:UIButtonTypeCustom]; itemButton.layer.borderWidth = 1.0f; itemButton.layer.borderColor = UIColorHex(0xD2D1CF).CGColor; itemButton.titleLabel.font = [UIFont systemFontOfSize:7.f]; [itemButton addTarget:self action:@selector(itemButtonClickdo:) forControlEvents:UIControlEventTouchUpInside]; [contentView addSubview:itemButton]; self.itemButton = itemButton; [itemButton mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(contentView); }]; } - (void)setType:(NSInteger)type { [self.itemButton setTitleColor:UIColor.blackColor forState:UIControlStateNormal]; [self.itemButton setTitleColor:UIColor.whiteColor forState:UIControlStateSelected]; [self.itemButton setBackgroundImage:[UIImage imageWithColor:UIColor.whiteColor size:CGSizeMake(100, 100)] forState:UIControlStateNormal]; [self.itemButton setBackgroundImage:[UIImage imageWithColor:UIColorHex(0x3169CE) size:CGSizeMake(100, 100)] forState:UIControlStateSelected]; } //点击 - (void)itemButtonClickdo:(UIButton*)btn { } @end