添加底部view
This commit is contained in:
@@ -8,8 +8,9 @@
|
||||
#import "UICollectionViewLeftAlignedLayout.h"
|
||||
#import "KBSkinDetailHeaderCell.h"
|
||||
#import "KBSkinTagsContainerCell.h"
|
||||
#import "KBSkinCardCell.h" // 已有的 皮肤卡片 cell(用作 2 列网格)
|
||||
#import "KBSkinCardCell.h"
|
||||
#import "KBSkinSectionTitleCell.h"
|
||||
#import "KBSkinBottomActionView.h"
|
||||
|
||||
static NSString * const kHeaderCellId = @"kHeaderCellId";
|
||||
static NSString * const kTagsContainerCellId = @"kTagsContainerCellId";
|
||||
@@ -26,6 +27,7 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
|
||||
|
||||
@interface KBSkinDetailVC () <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
|
||||
@property (nonatomic, strong) UICollectionView *collectionView; // 主列表
|
||||
@property (nonatomic, strong) KBSkinBottomActionView *bottomBar; // 底部操作条
|
||||
@property (nonatomic, copy) NSArray<NSString *> *tags; // 标签数据
|
||||
@property (nonatomic, copy) NSArray<NSDictionary *> *gridData; // 底部网格数据
|
||||
@end
|
||||
@@ -44,9 +46,26 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
|
||||
@{ @"title": @"Dopamine" }, @{ @"title": @"Dopamine" },
|
||||
];
|
||||
|
||||
// 1. 列表
|
||||
[self.view addSubview:self.collectionView];
|
||||
|
||||
// 2. 底部操作条(左右 15,高 45,可点击)
|
||||
[self.view addSubview:self.bottomBar];
|
||||
[self.bottomBar mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.view).offset(15);
|
||||
make.right.equalTo(self.view).offset(-15);
|
||||
make.height.mas_equalTo([KBSkinBottomActionView preferredHeight]);
|
||||
if (@available(iOS 11.0, *)) {
|
||||
make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
|
||||
} else {
|
||||
make.bottom.equalTo(self.view);
|
||||
}
|
||||
}];
|
||||
|
||||
// 列表底部距离操作条顶部 10
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.view);
|
||||
make.top.left.right.equalTo(self.view);
|
||||
make.bottom.equalTo(self.bottomBar.mas_top).offset(-10);
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -156,4 +175,27 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
|
||||
return _collectionView;
|
||||
}
|
||||
|
||||
#pragma mark - Lazy (Bottom Bar)
|
||||
|
||||
- (KBSkinBottomActionView *)bottomBar {
|
||||
if (!_bottomBar) {
|
||||
_bottomBar = [[KBSkinBottomActionView alloc] init];
|
||||
// 中文注释:配置文案与图标,可根据业务传入金币图/价格
|
||||
[_bottomBar configWithTitle:@"Download" price:@"20" icon:nil];
|
||||
__weak typeof(self) weakSelf = self;
|
||||
_bottomBar.tapHandler = ^{
|
||||
// 示例:点击下载/购买
|
||||
// [KBHUD showText:@"点击了下载"];
|
||||
// TODO: 在此处触发下载/购买逻辑
|
||||
[weakSelf handleDownloadAction];
|
||||
};
|
||||
}
|
||||
return _bottomBar;
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
- (void)handleDownloadAction {
|
||||
// 预留:下载/购买动作
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user