You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.4 KiB

2 years ago
//
// PPFriendTableViewCell.m
// tongxin
//
// Created by ecell on 2023/5/18.
// Copyright © 2023 xTT. All rights reserved.
//
#import "PPFriendTableViewCell.h"
@interface PPFriendTableViewCell ()
@property (nonatomic ,weak) UIImageView *iconImg;
@property (nonatomic ,weak) UILabel *nameLabel;
@end
@implementation PPFriendTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self)
{
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.backgroundColor = UIColor.clearColor;
[self subCellView];
}
return self;
}
- (void)setMsgModel:(NSDictionary *)msgModel
{
_msgModel = msgModel;
[self.iconImg sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",msgModel[@"avator"]]] placeholderImage:ImageName_(@"icon_boy_head_portrait")];
self.nameLabel.text = msgModel[@"name"];
}
- (void)subCellView
{
UIView *bgView = [UIView new];
bgView.backgroundColor = UIColor.whiteColor;
bgView.layer.cornerRadius = 8;
bgView.layer.masksToBounds = YES;
[self.contentView addSubview:bgView];
[bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contentView).offset(15);
make.left.right.equalTo(self.contentView).inset(15);
make.bottom.equalTo(self.contentView.mas_bottom);
}];
UIImageView *iconImg = [UIImageView new];
iconImg.layer.cornerRadius = 5;
iconImg.layer.masksToBounds = YES;
self.iconImg = iconImg;
[bgView addSubview:iconImg];
[iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(bgView);
make.left.equalTo(bgView).offset(15);
make.size.mas_equalTo(CGSizeMake(44, 44));
}];
UILabel *nameLabel = [UILabel new];
nameLabel.font = Font_(16);
nameLabel.textColor = KKGrey121;
self.nameLabel = nameLabel;
[bgView addSubview:nameLabel];
[nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(iconImg.mas_right).offset(10);
make.top.equalTo(iconImg);
}];
}
- (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
}
@end