1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- //
- // StudentDetailInfoCell.m
- // LN_School
- //
- // Created by 张嵘 on 2019/7/25.
- // Copyright © 2019 Danson. All rights reserved.
- //
- #import "StudentDetailInfoCell.h"
- #import "StudentDetailInfoModel.h"
- @interface StudentDetailInfoCell ()
- @property (nonatomic, readwrite, strong) UILabel *titleLabel;
- @property (nonatomic, readwrite, strong) UILabel *contentLabel;
- @end
- @implementation StudentDetailInfoCell
- #pragma mark - Life Cycle
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.contentView.backgroundColor = UIColor.whiteColor;
- [self.contentView addSubview:self.titleLabel];
- [self.contentView addSubview:self.contentLabel];
- }
- __weak typeof(self) weakS = self;
- [self addTapActionWithBlock:^(UIGestureRecognizer *gestureRecoginzer) {
- [weakS clickSelf];
- }];
- return self;
- }
- - (void)layoutSubviews {
- [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_offset(16);
- make.centerY.mas_equalTo(self.contentView);
- make.size.mas_equalTo(CGSizeMake((self.bounds.size.width - (3 * 16)) / 3.0, self.bounds.size.height));
- }];
- [_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(_titleLabel.mas_right).mas_offset(16);
- make.centerY.mas_equalTo(self.contentView);
- make.size.mas_equalTo(CGSizeMake((2 * (self.bounds.size.width - (3 * 16))) / 3.0, self.bounds.size.height));
- }];
- [super layoutSubviews];
- }
- #pragma mark - Private Functions
- - (void)updateCellUI:(__kindof HDCellModel *)model {
- if ([model.orgData isKindOfClass:[StudentDetailInfoModel class]]) {
- StudentDetailInfoModel *studentDetailInfoModel = model.orgData;
- self.titleLabel.text = studentDetailInfoModel.titleString;
- self.contentLabel.text = studentDetailInfoModel.contentString;
- }
- }
- - (void)clickSelf {
- self.callback(self.hdModel);
- }
- #pragma mark - Lazy Load
- - (UILabel *)titleLabel {
- if (!_titleLabel) {
- _titleLabel = [[UILabel alloc] init];
- _titleLabel.numberOfLines = 0;
- _titleLabel.font = [UIFont systemFontOfSize:15];
- _titleLabel.textColor = RQTitleTextColor;
- }
- return _titleLabel;
- }
- - (UILabel *)contentLabel {
- if (!_contentLabel) {
- _contentLabel = [[UILabel alloc] init];
- _contentLabel.numberOfLines = 0;
- _contentLabel.font = [UIFont systemFontOfSize:15];
- _contentLabel.textColor = RQContentTextColor;
- }
- return _contentLabel;
- }
- @end
|