49 lines
958 B
Objective-C
49 lines
958 B
Objective-C
//
|
|
// ProfilePhotoCell.m
|
|
// TreeHole
|
|
//
|
|
// Created by 谢培艺 on 2022/6/3.
|
|
//
|
|
|
|
#import "ProfilePhotoCell.h"
|
|
|
|
NSString * const ProfilePhotoCellID = @"ProfilePhotoCellID";
|
|
@interface ProfilePhotoCell ()
|
|
|
|
|
|
@end
|
|
|
|
@implementation ProfilePhotoCell
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
if (self = [super initWithFrame:frame]) {
|
|
[self setupUI];
|
|
}
|
|
|
|
return self;
|
|
}
|
|
|
|
- (void)layoutSubviews {
|
|
[super layoutSubviews];
|
|
self.imageView.frame = self.bounds;
|
|
}
|
|
|
|
- (void)setupUI {
|
|
PYImageView *imageView = [[PYImageView alloc] init];
|
|
imageView.backgroundColor = [UIColor clearColor];
|
|
self.imageView = imageView;
|
|
[self.contentView addSubview:imageView];
|
|
}
|
|
|
|
- (void)setPhoto:(ProfilePhoto *)photo {
|
|
_photo = photo;
|
|
if ([photo.url containsString:@".web"]) {
|
|
self.imageView.image = [UIImage imageNamed:@"TH_defalut_avatar"];
|
|
} else {
|
|
self.imageView.imageUrl = photo.url;
|
|
}
|
|
|
|
}
|
|
|
|
@end
|