Files
peko-ios/YuMi/Modules/YMRoom/View/QuickMessageView/XPRoomQuidkMessageCell.m
2024-04-11 17:05:27 +08:00

69 lines
1.6 KiB
Objective-C

//
// YMRoomQuidkMessageCell.m
// YUMI
//
// Created by YUMI on 2022/9/28.
//
#import "XPRoomQuidkMessageCell.h"
///Third
#import <Masonry/Masonry.h>
///Model
#import "RoomTagModel.h"
#import "DJDKMIMOMColor.h"
#import "RoomClassifyModel.h"
@interface XPRoomQuidkMessageCell ()
@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UILabel *tagLabel;
@end
@implementation XPRoomQuidkMessageCell
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self addSubview:self.bgView];
[self addSubview:self.tagLabel];
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(22);
make.leading.trailing.mas_equalTo(self.contentView);
make.centerY.mas_equalTo(self.contentView);
}];
[self.tagLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self);
}];
}
return self;
}
- (void)setTitle:(NSString *)title {
self.tagLabel.text = title;
}
#pragma mark - Getter & Setter
- (UILabel *)tagLabel {
if (!_tagLabel) {
_tagLabel = [[UILabel alloc] init];
_tagLabel.textColor = UIColor.whiteColor;
_tagLabel.font = [UIFont systemFontOfSize:12];
_tagLabel.textAlignment = NSTextAlignmentCenter;
}
return _tagLabel;
}
- (UIView *)bgView {
if (!_bgView) {
_bgView = [[UIView alloc] init];
_bgView.backgroundColor = UIColorRGBAlpha(0xffffff, 0.3);
_bgView.layer.cornerRadius = 11;
_bgView.layer.masksToBounds = YES;
}
return _bgView;
}
@end