123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- //
- // YOUPAILZGiftNoticeCell.m
- // MSYOUPAI
- //
- // Created by CY on 2022/2/28.
- // Copyright © 2022 MS. All rights reserved.
- //
- #import "YOUPAILZGiftNoticeCell.h"
- @interface YOUPAILZGiftNoticeCell ()
- @property (nonatomic, weak) UIImageView *youpaipformAvatarImgV; // 发送者头像
- @property (nonatomic, weak) UILabel *youpaipformNicknameL; // 发送者昵称
- @property (nonatomic, weak) UIImageView *youpaipgiftImgV; // 礼物图片
- @property (nonatomic, weak) UILabel *youpaipgiftCountL; // 礼物数量
- @property (nonatomic, weak) UIImageView *youpaiptoAvatarImgV; // 接受者头像
- @property (nonatomic, weak) UILabel *youpaiptoNicknameL; // 接受者昵称
- @end
- @implementation YOUPAILZGiftNoticeCell
- - (instancetype)initWithFrame:(CGRect)frame{
- if (self = [super initWithFrame: frame]) {
- [self youpaifinitUI];
- }
- return self;
- }
- - (void)youpaifinitUI{
- UIView *fromBgView = [[UIView alloc] init];
- [self.contentView addSubview:fromBgView];
- [fromBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(6.0f);
- make.centerY.equalTo(self.contentView);
- make.width.offset(44.0f);
- }];
-
- UIImageView *youpaipformAvatarImgV = [[UIImageView alloc] init];
- youpaipformAvatarImgV.layer.cornerRadius = 14.0f;
- youpaipformAvatarImgV.layer.borderColor = [UIColor whiteColor].CGColor;
- youpaipformAvatarImgV.layer.borderWidth = 1.0f;
- youpaipformAvatarImgV.clipsToBounds = YES;
- youpaipformAvatarImgV.contentMode = UIViewContentModeScaleAspectFill;
- [fromBgView addSubview:youpaipformAvatarImgV];
- self.youpaipformAvatarImgV = youpaipformAvatarImgV;
- [youpaipformAvatarImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.offset(0.0f);
- make.centerX.equalTo(fromBgView);
- make.size.mas_offset(CGSizeMake(28.0f, 28.0f));
- }];
-
- UILabel *youpaipformNicknameL = [[UILabel alloc] init];
- youpaipformNicknameL.font = LCFont(10.0f);
- youpaipformNicknameL.textColor = LZ475A7DColor;
- youpaipformNicknameL.textAlignment = NSTextAlignmentCenter;
- [fromBgView addSubview:youpaipformNicknameL];
- self.youpaipformNicknameL = youpaipformNicknameL;
- [youpaipformNicknameL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.offset(0.0f);
- make.bottom.offset(0.0f);
- make.height.offset(12.0f);
- make.top.equalTo(youpaipformAvatarImgV.mas_bottom).offset(2.0f);
- }];
-
- UILabel *youpaifgiveL = [[UILabel alloc] init];
- youpaifgiveL.font = LCBoldFont(11.0f);
- youpaifgiveL.textColor = LZ475A7DColor;
- youpaifgiveL.text = @"赠送";
- [self.contentView addSubview:youpaifgiveL];
- [youpaifgiveL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(fromBgView.mas_right).offset(4.0f);
- make.centerY.equalTo(youpaipformAvatarImgV);
- }];
-
- UIImageView *youpaipgiftImgV = [[UIImageView alloc] init];
- youpaipgiftImgV.contentMode = UIViewContentModeScaleAspectFill;
- [self.contentView addSubview:youpaipgiftImgV];
- self.youpaipgiftImgV = youpaipgiftImgV;
- [youpaipgiftImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(youpaipformAvatarImgV);
- make.left.equalTo(youpaifgiveL.mas_right).offset(4.0f);
- make.size.mas_offset(CGSizeMake(38.0f, 38.0f));
- }];
-
-
- UILabel *youpaipgiftCountL = [[UILabel alloc] init];
- youpaipgiftCountL.font = LCBoldFont(11.0f);
- youpaipgiftCountL.textColor = LZ475A7DColor;
- youpaipgiftCountL.text = @"x1";
- [self.contentView addSubview:youpaipgiftCountL];
- self.youpaipgiftCountL = youpaipgiftCountL;
- [youpaipgiftCountL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(youpaipgiftImgV.mas_right).offset(4.0f);
- make.centerY.equalTo(youpaipformAvatarImgV);
- }];
-
- UIView *toBgView = [[UIView alloc] init];
- [self.contentView addSubview:toBgView];
- [toBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(youpaipgiftCountL.mas_right).offset(4.0f);
- make.centerY.equalTo(self.contentView);
- make.width.offset(44.0f);
- }];
- UIImageView *youpaiptoAvatarImgV = [[UIImageView alloc] init];
- youpaiptoAvatarImgV.layer.cornerRadius = 14.0f;
- youpaiptoAvatarImgV.layer.borderColor = [UIColor whiteColor].CGColor;
- youpaiptoAvatarImgV.layer.borderWidth = 1.0f;
- youpaiptoAvatarImgV.clipsToBounds = YES;
- youpaiptoAvatarImgV.contentMode = UIViewContentModeScaleAspectFill;
- [toBgView addSubview:youpaiptoAvatarImgV];
- self.youpaiptoAvatarImgV = youpaiptoAvatarImgV;
- [youpaiptoAvatarImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.offset(0.0f);
- make.centerX.equalTo(toBgView);
- make.size.mas_offset(CGSizeMake(28.0f, 28.0f));
- }];
- UILabel *youpaiptoNicknameL = [[UILabel alloc] init];
- youpaiptoNicknameL.font = LCFont(10.0f);
- youpaiptoNicknameL.textColor = LZ475A7DColor;
- youpaiptoNicknameL.textAlignment = NSTextAlignmentCenter;
- [toBgView addSubview:youpaiptoNicknameL];
- self.youpaiptoNicknameL = youpaiptoNicknameL;
- [youpaiptoNicknameL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.offset(0.0f);
- make.bottom.offset(0.0f);
- make.height.offset(12.0f);
- make.top.equalTo(youpaiptoAvatarImgV.mas_bottom).offset(2.0f);
- }];
-
- }
- - (void)youpaifreloadWithModel:(YOUPAILZHomeTVModel *)model{
- [self.youpaipformAvatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipfrom_avatar]];
- [self.youpaiptoAvatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipto_avatar]];
- self.youpaipformNicknameL.text = model.youpaipfrom_nickname;
- self.youpaiptoNicknameL.text = model.youpaipto_nickname;
- self.youpaipgiftCountL.text = [NSString stringWithFormat:@"x%@",model.youpaipgift_count];
- [self.youpaipgiftImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipgift_img]];
- }
- @end
|