1
This commit is contained in:
@@ -9,11 +9,13 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class KBShopThemeDetailModel;
|
||||
|
||||
@interface KBSkinDetailHeaderCell : UICollectionViewCell
|
||||
@property (nonatomic, strong) UIImageView *coverView; // 顶部大图
|
||||
@property (nonatomic, strong) UILabel *leftLabel; // 下方左侧文案(#1B1F1A)
|
||||
@property (nonatomic, strong) UILabel *rightLabel; // 下方右侧文案(#02BEAC)
|
||||
- (void)configWithTitle:(NSString *)title right:(NSString *)right;
|
||||
- (void)configWithDetail:(nullable KBShopThemeDetailModel *)detail;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
//
|
||||
|
||||
#import "KBSkinDetailHeaderCell.h"
|
||||
#import "UIImageView+KBWebImage.h"
|
||||
#import "KBShopThemeDetailModel.h"
|
||||
|
||||
@implementation KBSkinDetailHeaderCell
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
@@ -37,12 +39,18 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)configWithTitle:(NSString *)title right:(NSString *)right {
|
||||
// 演示:标题/下载量文案
|
||||
self.leftLabel.text = title.length ? title : @"Dopamine";
|
||||
self.rightLabel.text = right.length ? right : @"Download: 1 Million";
|
||||
// 本示例不做网络图,直接用占位背景色
|
||||
self.coverView.backgroundColor = [UIColor colorWithWhite:0.94 alpha:1.0];
|
||||
- (void)configWithDetail:(KBShopThemeDetailModel *)detail {
|
||||
NSString *title = detail.themeName.length ? detail.themeName : @"Dopamine";
|
||||
NSString *download = detail.themeDownload.length ? detail.themeDownload : @"0";
|
||||
NSString *downloadText = [NSString stringWithFormat:@"%@: %@", KBLocalized(@"Download"), download];
|
||||
self.leftLabel.text = title;
|
||||
self.rightLabel.text = downloadText;
|
||||
UIImage *placeholder = [UIImage imageNamed:@"shop_headbigBg_icon"];
|
||||
if (detail.themePreviewImageUrl.length) {
|
||||
[self.coverView kb_setImageURL:detail.themePreviewImageUrl placeholder:placeholder];
|
||||
} else {
|
||||
self.coverView.image = placeholder;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Lazy
|
||||
@@ -51,6 +59,7 @@
|
||||
_coverView = [[UIImageView alloc] init];
|
||||
_coverView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_coverView.clipsToBounds = YES;
|
||||
_coverView.layer.cornerRadius = 12;
|
||||
}
|
||||
return _coverView;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user