| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- //
- // FavoritesPictrueCell.m
- // AIIM
- //
- // Created by qitewei on 2025/4/30.
- //
- #import "FavoritesPictrueCell.h"
- #import "CryptoAES.h"
- @interface FavoritesPictrueCell()
- @property (nonatomic, strong) UILabel * contentLbl;
- @property (nonatomic, strong) UILabel * timeLbl;
- @property (nonatomic, strong) UIImageView * contentImageView;
- @end
- @implementation FavoritesPictrueCell
- - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
- if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
- [self configUI];
- }
- return self;
- }
- - (void)configUI{
- self.contentView.backgroundColor = globalColor(GCTypeDark6);
-
- [self.contentView addSubview:self.timeLbl];
- [self.timeLbl mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(12);
- make.left.mas_equalTo(20);
- make.bottom.mas_equalTo(-24);
- }];
-
- [self.contentView addSubview:self.contentLbl];
- CGFloat contentMaxWidth = [UIScreen mainScreen].bounds.size.width-152;
- [self.contentLbl mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(14);
- make.width.mas_lessThanOrEqualTo(contentMaxWidth);
- make.left.mas_equalTo(20);
- make.bottom.mas_equalTo(self.timeLbl.mas_top).offset(-12);
- }];
-
- [self.contentView addSubview:self.contentImageView];
- [self.contentImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(CGSizeMake(60, 60));
- make.left.mas_equalTo(self.contentLbl.mas_right).offset(12);
- make.top.mas_equalTo(16);
- make.bottom.mas_equalTo(-16);
- }];
- }
- - (void)setMsg:(NSDictionary *)msg{
- _msg = msg;
-
- NSString *extend = msg[@"extend"];
- NSData *data = [extend dataUsingEncoding:NSUTF8StringEncoding];
- NSError *error;
- NSDictionary *extendDict = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
- self.contentLbl.text = extendDict[@"fileName"]?:@"";
- [self.contentImageView sd_setImageWithURL:getURL(extendDict[@"url"]) placeholderImage:kImageMake(@"downloadfile")];
-
- self.timeLbl.text = msg[@"createTime"];
- }
- #pragma mark lazy
- - (UILabel *)contentLbl{
- if (!_contentLbl) {
- _contentLbl = [[UILabel alloc] init];
- _contentLbl.textColor = UIColor.whiteColor;
- _contentLbl.font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
- }
- return _contentLbl;
- }
- - (UILabel *)timeLbl{
- if (!_timeLbl) {
- _timeLbl = [[UILabel alloc] init];
- _timeLbl.textColor = globalColor(GCTypeDark7);
- _timeLbl.font = [UIFont systemFontOfSize:12 weight:UIFontWeightRegular];
- }
- return _timeLbl;
- }
- - (UIImageView *)contentImageView{
- if (!_contentImageView) {
- _contentImageView = [[UIImageView alloc] init];
- _contentImageView.layer.cornerRadius = 10.f;
- _contentImageView.clipsToBounds = YES;
- _contentImageView.contentMode = UIViewContentModeScaleAspectFill;
- }
- return _contentImageView;
- }
- @end
|