3
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user