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;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// 还原设计稿(见需求截图):左侧「Points\nMall」标题 + 右侧大金币装饰
|
||||
/// 下方卡片显示积分与「Recharge」按钮。
|
||||
/// Masonry 约束 + 懒加载,中文注释。
|
||||
@class KBShopThemeDetailModel;
|
||||
|
||||
@interface KBShopHeadView : UIView
|
||||
|
||||
/// 点击充值回调
|
||||
@@ -21,6 +23,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// 更新积分展示
|
||||
- (void)updatePoints:(NSString *)points;
|
||||
|
||||
/// 根据主题详情更新头图(展示主题预览图等)
|
||||
- (void)configureWithThemeDetail:(KBShopThemeDetailModel * _Nullable)detail;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#import "KBShopHeadView.h"
|
||||
#import "KBJfPay.h"
|
||||
#import "UIImageView+KBWebImage.h"
|
||||
#import "KBShopThemeDetailModel.h"
|
||||
|
||||
@interface KBShopHeadView ()
|
||||
|
||||
@@ -172,6 +174,16 @@
|
||||
self.amountLabel.text = points;
|
||||
}
|
||||
|
||||
- (void)configureWithThemeDetail:(KBShopThemeDetailModel * _Nullable)detail {
|
||||
NSString *urlString = detail.themePreviewImageUrl;
|
||||
UIImage *placeholder = [UIImage imageNamed:@"shop_headbigBg_icon"];
|
||||
if (urlString.length > 0) {
|
||||
[self.bigCoinView kb_setImageURL:urlString placeholder:placeholder];
|
||||
} else {
|
||||
self.bigCoinView.image = placeholder;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
- (void)onRechargeTappedAction {
|
||||
// if (self.onRechargeTapped) { self.onRechargeTapped(); }
|
||||
|
||||
@@ -92,10 +92,7 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
|
||||
switch (indexPath.section) {
|
||||
case KBSkinDetailSectionHeader: {
|
||||
KBSkinDetailHeaderCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kHeaderCellId forIndexPath:indexPath];
|
||||
NSString *title = self.detailModel.themeName.length ? self.detailModel.themeName : @"Dopamine";
|
||||
NSString *download = self.detailModel.themeDownload.length ? self.detailModel.themeDownload : @"0";
|
||||
NSString *right = [NSString stringWithFormat:@"%@: %@", KBLocalized(@"Download"), download];
|
||||
[cell configWithTitle:title right:right];
|
||||
[cell configWithDetail:self.detailModel];
|
||||
return cell;
|
||||
}
|
||||
case KBSkinDetailSectionTags: {
|
||||
|
||||
Reference in New Issue
Block a user