123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- //
- // ASPointDetailCell.m
- // Asteria
- //
- // Created by iOS on 2023/6/24.
- //
- #import "ASPointDetailCell.h"
- @interface ASPointDetailCell ()
- @property (nonatomic, strong) UIView *bgV;
- @property (nonatomic, strong) UIView *lineV;
- @property (nonatomic, strong) UILabel *titleLb;
- @property (nonatomic, strong) UILabel *pointsLb;
- @property (nonatomic, strong) UILabel *elsePointsLb;
- @property (nonatomic, strong) UILabel *dateLb;
- @end
- @implementation ASPointDetailCell
- - (void)setData:(ASPointDetailModel *)model {
- self.titleLb.text = model.event_data;
-
- self.dateLb.text = model.created_at;
- self.pointsLb.text = [NSString stringWithFormat:@"%@ Points",model.points_delta];
- self.elsePointsLb.text = [NSString stringWithFormat:@"My points:%@",model.points_balance];
- }
- -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
- [self confgSubV];
- }
- return self;
- }
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- - (void)confgSubV {
- self.backgroundColor = Col_FFF;
- self.contentView.backgroundColor = Col_FFF;
- self.selectionStyle = UITableViewCellSelectionStyleNone;
-
- [self.contentView addSubview:self.bgV];
- [self.bgV addSubview:self.titleLb];
- [self.bgV addSubview:self.pointsLb];
- [self.bgV addSubview:self.elsePointsLb];
- [self.bgV addSubview:self.dateLb];
-
- [self.bgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self.contentView);
- // make.height.equalTo(@80);
- }];
-
- [self.bgV addSubview:self.lineV];
- [self.lineV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.equalTo(@1);
- make.leading.equalTo(self.bgV).offset(10);
- make.trailing.equalTo(self.bgV).offset(-10);
- make.bottom.equalTo(self.bgV);
- }];
- [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.bgV).offset(10);
- make.top.equalTo(self.bgV).offset(20);
- make.right.equalTo(self.bgV).offset(-120);
- make.height.greaterThanOrEqualTo(@17);
- }];
- [self.dateLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.titleLb.mas_bottom).offset(12);
- make.left.equalTo(self.bgV).offset(10);
- make.height.equalTo(@14);
- make.bottom.equalTo(self.bgV).offset(-20);
- }];
- [self.pointsLb setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
- [self.pointsLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.bgV.mas_right).offset(-10);
- make.left.equalTo(self.titleLb.mas_right).offset(30);
- make.top.equalTo(self.titleLb);
- make.height.equalTo(@14);
- make.width.mas_equalTo(@100);
- }];
-
- [self.elsePointsLb setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
- [self.elsePointsLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.bgV.mas_right).offset(-10);
- make.left.equalTo(self.dateLb.mas_right).offset(30);
- make.centerY.equalTo(self.dateLb);
- make.height.equalTo(@14);
- }];
-
- }
- - (UILabel *)titleLb {
- if (!_titleLb) {
- UILabel *lb = [UILabel new];
- lb.textColor = [[UIColor colorWithHexString:@"#000000"] colorWithAlphaComponent:1];
-
- lb.font = [UIFont fontWithName:Rob_Regular size:14];
- lb.numberOfLines = 0;
- _titleLb = lb;
- }
- return _titleLb;
- }
- - (UILabel *)pointsLb {
- if (!_pointsLb) {
- UILabel *lb = [UILabel new];
- lb.textColor = [[UIColor colorWithHexString:@"#000000"] colorWithAlphaComponent:1];
- lb.textAlignment = NSTextAlignmentRight;
- lb.font = [UIFont fontWithName:Rob_Regular size:12];
- lb.numberOfLines = 1;
- [lb setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
- _pointsLb = lb;
- _pointsLb.adjustsFontSizeToFitWidth = YES;
- }
- return _pointsLb;
- }
- - (UILabel *)elsePointsLb {
- if (!_elsePointsLb) {
- UILabel *lb = [UILabel new];
- lb.textColor = [[UIColor colorWithHexString:@"#000000"] colorWithAlphaComponent:0.6];
- lb.textAlignment = NSTextAlignmentRight;
- lb.font = [UIFont fontWithName:Rob_Regular size:12];
- lb.numberOfLines = 1;
- _elsePointsLb = lb;
- }
- return _elsePointsLb;
- }
- - (UILabel *)dateLb {
- if (!_dateLb) {
- UILabel *lb = [UILabel new];
- lb.textColor = [[UIColor colorWithHexString:@"#000000"] colorWithAlphaComponent:0.6];
- lb.textAlignment = NSTextAlignmentLeft;
- lb.font = [UIFont fontWithName:Rob_Regular size:12];
- lb.numberOfLines = 1;
- _dateLb = lb;
- }
- return _dateLb;
- }
- -(UIView *)bgV {
- if (!_bgV) {
- UIView *v = [UIView new];
- v.backgroundColor = Col_FFF;
- _bgV = v;
- }
- return _bgV;
- }
- -(UIView *)lineV {
- if (!_lineV) {
- UIView *v = [UIView new];
- v.backgroundColor = [_043632 colorWithAlphaComponent:0.1];
- _lineV = v;
- }
- return _lineV;
- }
- @end
|