添加底部view

This commit is contained in:
2025-11-10 15:29:21 +08:00
parent fac5e7657c
commit 97316c7989
6 changed files with 243 additions and 6 deletions

View File

@@ -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