This commit is contained in:
2025-12-03 19:19:20 +08:00
parent b00283cd96
commit 716f91bdd0
8 changed files with 147 additions and 47 deletions

View File

@@ -6,16 +6,20 @@
//
#import <UIKit/UIKit.h>
#import "KBCharacter.h"
NS_ASSUME_NONNULL_BEGIN
/// 首页排行榜卡片 Cell两列
@interface HomeRankCardCell : UICollectionViewCell
/// 当前展示的角色模型
@property (nonatomic, strong, nullable) KBCharacter *character;
/// 点击加号/勾选按钮回调
@property (nonatomic, copy, nullable) void (^onTapAction)(void);
/// 统一配置数据
/// 旧的配置方法(兼容用,不推荐继续使用)
- (void)configureWithTitle:(NSString *)title
desc:(NSString *)desc
people:(NSString *)people
@@ -24,4 +28,3 @@ NS_ASSUME_NONNULL_BEGIN
@end
NS_ASSUME_NONNULL_END

View File

@@ -10,13 +10,13 @@
#import "UIView+KBShadow.h"
@interface HomeRankCardCell ()
@property (nonatomic, strong) UIView *shadowView; //
@property (nonatomic, strong) UIView *cardView; //
@property (nonatomic, strong) UIView *badgeCircle; //
@property (nonatomic, strong) UIView *shadowView; //
@property (nonatomic, strong) UIImageView *cardView; //
@property (nonatomic, strong) UIView *badgeCircle; //
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *descLabel;
@property (nonatomic, strong) UILabel *peopleLabel;
@property (nonatomic, strong) UIButton *actionBtn; // /
@property (nonatomic, strong) UIButton *actionBtn; // /
@property (nonatomic, assign) BOOL added;
@end
@@ -125,6 +125,17 @@
}
}
- (void)setCharacter:(KBCharacter *)character {
_character = character;
NSString *title = character.characterName ?: @"";
NSString *people = character.download ?: @"";
NSString *desc = @"Be Neither Too Close\nNor Too Distant..."; //
BOOL added = character.added;
[self configureWithTitle:title desc:desc people:people added:added];
}
#pragma mark - Lazy UI
- (UIView *)shadowView {
@@ -135,12 +146,15 @@
return _shadowView;
}
- (UIView *)cardView {
- (UIImageView *)cardView {
if (!_cardView) {
_cardView = [UIView new];
_cardView = [[UIImageView alloc] init];
_cardView.backgroundColor = UIColor.whiteColor;
_cardView.layer.cornerRadius = 18.0;
_cardView.layer.masksToBounds = YES;
_cardView.contentMode = UIViewContentModeScaleAspectFill;
//
_cardView.image = [UIImage imageNamed:@"home_rank_card_bg"];
}
return _cardView;
}