This commit is contained in:
2025-12-23 14:02:44 +08:00
parent 6ad2079351
commit 2e1c261775
9 changed files with 23 additions and 9 deletions

View File

@@ -5,12 +5,12 @@
"scale" : "1x" "scale" : "1x"
}, },
{ {
"filename" : "placeholder_image_icon@2x.png", "filename" : "切图 232@2x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"filename" : "placeholder_image_icon@3x.png", "filename" : "切图 232@3x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "3x" "scale" : "3x"
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View File

@@ -15,6 +15,12 @@ static inline SDWebImageOptions KBWebImageDefaultOptions(void) {
SDWebImageProgressiveLoad; // SDWebImageProgressiveLoad; //
} }
static inline void KBWebImageEnsureIndicator(UIImageView *imageView) {
if (!imageView.sd_imageIndicator) {
imageView.sd_imageIndicator = SDWebImageActivityIndicator.mediumIndicator;
}
}
static inline NSURL *_KBURL(id url) { static inline NSURL *_KBURL(id url) {
if (!url) return nil; if (!url) return nil;
if ([url isKindOfClass:NSURL.class]) return url; if ([url isKindOfClass:NSURL.class]) return url;
@@ -32,6 +38,7 @@ static inline NSURL *_KBURL(id url) {
NSURL *u = _KBURL(url); NSURL *u = _KBURL(url);
// //
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
KBWebImageEnsureIndicator(self);
[self sd_setImageWithURL:u [self sd_setImageWithURL:u
placeholderImage:placeholder placeholderImage:placeholder
options:options options:options
@@ -66,6 +73,7 @@ static inline NSURL *_KBURL(id url) {
} }
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
KBWebImageEnsureIndicator(self);
[self sd_setImageWithURL:u [self sd_setImageWithURL:u
placeholderImage:placeholder placeholderImage:placeholder
options:options options:options
@@ -106,6 +114,7 @@ static inline NSURL *_KBURL(id url) {
NSDictionary *context = @{ SDWebImageContextImageTransformer : pipeline }; NSDictionary *context = @{ SDWebImageContextImageTransformer : pipeline };
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
KBWebImageEnsureIndicator(self);
[self sd_setImageWithURL:u [self sd_setImageWithURL:u
placeholderImage:placeholder placeholderImage:placeholder
options:options options:options

View File

@@ -12,9 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
@class KBShopThemeDetailModel; @class KBShopThemeDetailModel;
@interface KBSkinDetailHeaderCell : UICollectionViewCell @interface KBSkinDetailHeaderCell : UICollectionViewCell
@property (nonatomic, strong) UIImageView *coverView; // 顶部大图
@property (nonatomic, strong) UILabel *leftLabel; // 下方左侧文案(#1B1F1A
@property (nonatomic, strong) UILabel *rightLabel; // 下方右侧文案(#02BEAC
- (void)configWithDetail:(nullable KBShopThemeDetailModel *)detail; - (void)configWithDetail:(nullable KBShopThemeDetailModel *)detail;
@end @end

View File

@@ -8,7 +8,11 @@
#import "KBSkinDetailHeaderCell.h" #import "KBSkinDetailHeaderCell.h"
#import "UIImageView+KBWebImage.h" #import "UIImageView+KBWebImage.h"
#import "KBShopThemeDetailModel.h" #import "KBShopThemeDetailModel.h"
@interface KBSkinDetailHeaderCell()
@property (nonatomic, strong) UIImageView *coverView; //
@property (nonatomic, strong) UILabel *leftLabel; // #1B1F1A
@property (nonatomic, strong) UILabel *rightLabel; // #02BEAC
@end
@implementation KBSkinDetailHeaderCell @implementation KBSkinDetailHeaderCell
- (instancetype)initWithFrame:(CGRect)frame { - (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) { if (self = [super initWithFrame:frame]) {

View File

@@ -5,6 +5,8 @@
#import "KBTagCell.h" #import "KBTagCell.h"
static const CGFloat kKBTagMinWidth = 50.0;
@interface KBTagCell () @interface KBTagCell ()
@property (nonatomic, strong) UILabel *titleLabel; @property (nonatomic, strong) UILabel *titleLabel;
@end @end
@@ -29,10 +31,11 @@
} }
+ (CGSize)sizeForText:(NSString *)text { + (CGSize)sizeForText:(NSString *)text {
if (text.length == 0) { return CGSizeMake(40, 32); } if (text.length == 0) { return CGSizeMake(kKBTagMinWidth, 32); }
CGSize s = [text sizeWithAttributes:@{NSFontAttributeName:[KBFont regular:13]}]; CGSize s = [text sizeWithAttributes:@{NSFontAttributeName:[KBFont regular:13]}];
// 12 + 12 32 // 12 + 12 32
return CGSizeMake(ceil(s.width) + 24, 32); CGFloat width = ceil(s.width) + 24;
return CGSizeMake(MAX(width, kKBTagMinWidth), 32);
} }
#pragma mark - Lazy #pragma mark - Lazy
@@ -42,9 +45,9 @@
_titleLabel = [[UILabel alloc] init]; _titleLabel = [[UILabel alloc] init];
_titleLabel.font = [KBFont regular:13]; _titleLabel.font = [KBFont regular:13];
_titleLabel.textColor = [UIColor colorWithHex:0x1B1F1A]; _titleLabel.textColor = [UIColor colorWithHex:0x1B1F1A];
_titleLabel.textAlignment = NSTextAlignmentCenter;
} }
return _titleLabel; return _titleLabel;
} }
@end @end