78 lines
2.2 KiB
Objective-C
78 lines
2.2 KiB
Objective-C
//
|
|
// MineHeardTableViewCell.m
|
|
// EscortProject
|
|
//
|
|
// Created by 仁康信息 on 2023/7/26.
|
|
//
|
|
|
|
#import "MineHeardTableViewCell.h"
|
|
|
|
@interface MineHeardTableViewCell ()
|
|
|
|
@property (nonatomic, strong) UILabel * headLabel;
|
|
|
|
@property (nonatomic, strong) UIImageView * heardImage ;
|
|
|
|
@end
|
|
|
|
@implementation MineHeardTableViewCell
|
|
|
|
- (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
|
|
}
|
|
|
|
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
|
|
|
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
|
|
|
[self createUI];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)createUI {
|
|
|
|
self.headLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 24, 100, 14)];
|
|
self.headLabel.textColor = UIColorHex(#666666);
|
|
self.headLabel.text = @"头像";
|
|
self.headLabel.font = MEDIUMFONT(14);
|
|
self.headLabel.textAlignment = NSTextAlignmentLeft;
|
|
[self.contentView addSubview:self.headLabel];
|
|
|
|
self.heardImage = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenWidth - 33 - 45, 8, 45, 45)];
|
|
self.heardImage.layer.cornerRadius = 22.0;
|
|
self.heardImage.layer.masksToBounds = YES;
|
|
[self.contentView addSubview:self.heardImage];
|
|
}
|
|
|
|
- (void)setHeardModel:(MineCenterUserModel *)heardModel {
|
|
|
|
_heardModel = heardModel;
|
|
|
|
NSString * photo = [NSString stringWithFormat:@"%@%@",ResourceAddress,_heardModel.avatar];
|
|
|
|
NSString * str1 = @"\\";
|
|
|
|
photo = [ photo stringByReplacingOccurrencesOfString:str1 withString:@"/"];
|
|
|
|
NSString *encodedString3 = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef) photo, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL, kCFStringEncodingUTF8));
|
|
if ([_heardModel.sex integerValue] == 1) { //女[]
|
|
[self.heardImage sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:[UIImage imageNamed:@"heard_woman"]];
|
|
|
|
}else
|
|
{
|
|
[self.heardImage sd_setImageWithURL:[NSURL URLWithString:encodedString3] placeholderImage:[UIImage imageNamed:@"heard_man"]];
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@end
|