| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- //
- // 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
|