// // MOGuildImageOrTextBaseCell.m // MiMoLive // // Created by SuperC on 2023/10/26. // #import "MOGuildImageOrTextBaseCell.h" @implementation MOGuildImageOrTextBaseCell - (void)awakeFromNib { [super awakeFromNib]; // Initialization code [self.contentView addSubview:self.contantBtn]; [self.contantBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.contentView).offset(-27.0); make.centerY.equalTo(self.contentView); make.top.equalTo(self.contentView).offset(5.0); make.bottom.equalTo(self.contentView).offset(-5.0); }]; self.contantBtn.imageView.contentMode = UIViewContentModeScaleAspectFit; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } - (void)layoutSubviews{ [super layoutSubviews]; if(self.cellType == MOGuildOnlyTextCellType){ //纯文本 [self.contantBtn setBackgroundImage:[UIImage imageNamed:@""] forState:UIControlStateNormal]; [self.contantBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal]; [self.contantBtn mas_remakeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.contentView).offset(-27.0); make.centerY.equalTo(self.contentView); make.top.equalTo(self.contentView).offset(5.0); make.bottom.equalTo(self.contentView).offset(-5.0); }]; self.contantBtn.layer.cornerRadius = 0.0; self.contantBtn.layer.borderColor = [UIColor whiteColor].CGColor; } else if (self.cellType == MOGuildCountryImageCellType){ //国旗图片 [self.contantBtn setTitle:@"" forState:UIControlStateNormal]; [self.contantBtn mas_remakeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.contentView).offset(-27.0); make.centerY.equalTo(self.contentView); make.width.height.equalTo(@24.0); }]; self.contantBtn.layer.cornerRadius = 0.0; self.contantBtn.layer.borderColor = [UIColor whiteColor].CGColor; } else{ //工会头像图片 [self.contantBtn setTitle:@"" forState:UIControlStateNormal]; [self.contantBtn mas_remakeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.contentView).offset(-27.0); make.centerY.equalTo(self.contentView); make.width.height.equalTo(@24.0); }]; self.contantBtn.layer.cornerRadius = 24.0 / 2.0; self.contantBtn.layer.masksToBounds = YES; self.contantBtn.layer.borderColor = [MOTools colorWithHexString:@"#E72DD3" alpha:1.0].CGColor; self.contantBtn.layer.borderWidth = 1.0; } } - (BigBtn *)contantBtn{ if(!_contantBtn){ _contantBtn = [BigBtn buttonWithType:UIButtonTypeCustom]; [_contantBtn setTitleColor:[MOTools colorWithHexString:@"#120817" alpha:1.0] forState:UIControlStateNormal]; _contantBtn.titleLabel.font = [UIFont systemFontOfSize:14.0]; [_contantBtn setTitle:@"" forState:UIControlStateNormal]; [_contantBtn addTarget:self action:@selector(contantBtnClick) forControlEvents:UIControlEventTouchUpInside]; } return _contantBtn; } - (void)contantBtnClick{ self.itemBtnClick ? self.itemBtnClick() : nil; } - (IBAction)cellBtnClick:(id)sender { self.itemBtnClick ? self.itemBtnClick() : nil; } @end