71 lines
1.6 KiB
Mathematica
71 lines
1.6 KiB
Mathematica
![]() |
//
|
||
|
// XPRoomInsideOperationCell.m
|
||
|
// xplan-ios
|
||
|
//
|
||
|
// Created by GreenLand on 2022/9/30.
|
||
|
//
|
||
|
|
||
|
#import "XPRoomInsideOperationCell.h"
|
||
|
///Third
|
||
|
#import <Masonry/Masonry.h>
|
||
|
|
||
|
@interface XPRoomInsideOperationCell()
|
||
|
|
||
|
@property (nonatomic, strong) UIImageView *imageView;
|
||
|
@property (nonatomic, strong) UILabel *titleLabel;
|
||
|
|
||
|
@end
|
||
|
|
||
|
@implementation XPRoomInsideOperationCell
|
||
|
|
||
|
- (instancetype)initWithFrame:(CGRect)frame {
|
||
|
if (self = [super initWithFrame:frame]) {
|
||
|
[self initView];
|
||
|
[self initContraints];
|
||
|
}
|
||
|
return self;
|
||
|
}
|
||
|
|
||
|
- (void)initView {
|
||
|
[self addSubview:self.imageView];
|
||
|
[self addSubview:self.titleLabel];
|
||
|
}
|
||
|
|
||
|
- (void)initContraints {
|
||
|
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.top.centerX.mas_equalTo(self);
|
||
|
make.width.height.mas_equalTo(52);
|
||
|
}];
|
||
|
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.top.mas_equalTo(self.imageView.mas_bottom).mas_offset(4);
|
||
|
make.centerX.mas_equalTo(self);
|
||
|
make.height.mas_equalTo(12);
|
||
|
}];
|
||
|
}
|
||
|
|
||
|
- (void)setTitle:(NSString *)title {
|
||
|
self.titleLabel.text = title;
|
||
|
}
|
||
|
- (void)setImageName:(NSString *)imageName {
|
||
|
self.imageView.image = [UIImage imageNamed:imageName];
|
||
|
}
|
||
|
|
||
|
- (UIImageView *)imageView {
|
||
|
if (!_imageView) {
|
||
|
_imageView = [[UIImageView alloc] init];
|
||
|
}
|
||
|
return _imageView;
|
||
|
}
|
||
|
|
||
|
- (UILabel *)titleLabel{
|
||
|
if (!_titleLabel) {
|
||
|
UILabel *label = [[UILabel alloc] init];
|
||
|
label.font = [UIFont systemFontOfSize:10];
|
||
|
label.textColor = [UIColor whiteColor];
|
||
|
_titleLabel = label;
|
||
|
}
|
||
|
return _titleLabel;
|
||
|
}
|
||
|
|
||
|
@end
|