62 lines
1.3 KiB
Objective-C
62 lines
1.3 KiB
Objective-C
//
|
|
// XPRoomFaceTitleCollectionViewCell.m
|
|
// xplan-ios
|
|
//
|
|
// Created by 冯硕 on 2022/3/9.
|
|
//
|
|
|
|
#import "XPRoomFaceTitleCollectionViewCell.h"
|
|
///Third
|
|
#import <Masonry/Masonry.h>
|
|
///Tool
|
|
#import "ThemeColor.h"
|
|
///Model
|
|
#import "RoomFaceTitleItemModel.h"
|
|
|
|
@interface XPRoomFaceTitleCollectionViewCell ()
|
|
///标题
|
|
@property (nonatomic,strong) UILabel *titleLabel;
|
|
@end
|
|
|
|
@implementation XPRoomFaceTitleCollectionViewCell
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
{
|
|
self = [super initWithFrame:frame];
|
|
if (self) {
|
|
[self initSubViews];
|
|
[self initSubViewConstraints];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
#pragma mark - Private Method
|
|
- (void)initSubViews {
|
|
[self.contentView addSubview:self.titleLabel];
|
|
}
|
|
|
|
- (void)initSubViewConstraints {
|
|
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.edges.mas_equalTo(self.contentView);
|
|
}];
|
|
}
|
|
#pragma mark - Getters And Setters
|
|
- (void)setTitleModel:(RoomFaceTitleItemModel *)titleModel {
|
|
_titleModel = titleModel;
|
|
if (_titleLabel) {
|
|
self.titleLabel.text = _titleModel.title;
|
|
self.titleLabel.textColor = _titleModel.isSelect ? [ThemeColor appMainColor] : [UIColor whiteColor];
|
|
}
|
|
}
|
|
|
|
- (UILabel *)titleLabel {
|
|
if (!_titleLabel) {
|
|
_titleLabel = [[UILabel alloc] init];
|
|
_titleLabel.font = [UIFont systemFontOfSize:14];
|
|
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
|
}
|
|
return _titleLabel;
|
|
}
|
|
|
|
@end
|