This commit is contained in:
2025-11-17 15:39:03 +08:00
parent dc813fcabc
commit d849b201ca
7 changed files with 59 additions and 19 deletions

View File

@@ -11,7 +11,8 @@
#import "HomeHotCell.h" #import "HomeHotCell.h"
#import "HomeRankVC.h" #import "HomeRankVC.h"
#import "KBSearchVC.h" #import "KBSearchVC.h"
#import "HomeRankDetailPopView.h"
#import "LSTPopView.h"
#import <HWPanModal/HWPanModal.h> #import <HWPanModal/HWPanModal.h>
@interface HomeHotVC () <UITableViewDataSource, UITableViewDelegate> @interface HomeHotVC () <UITableViewDataSource, UITableViewDelegate>
@@ -81,12 +82,39 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES]; [tableView deselectRowAtIndexPath:indexPath animated:YES];
KBSearchVC *vc = [[KBSearchVC alloc] init]; // KBSearchVC *vc = [[KBSearchVC alloc] init];
// [self.navigationController pushViewController:vc animated:true]; // [self.navigationController pushViewController:vc animated:true];
UINavigationController *nav = KB_CURRENT_NAV; // UINavigationController *nav = KB_CURRENT_NAV;
// [nav pushViewController:vc animated:true]; // [nav pushViewController:vc animated:true];
NSLog(@"==="); NSLog(@"===");
// ->
NSDictionary *d = self.dataSource[indexPath.item];
//
CGFloat width = MIN(KB_SCREEN_WIDTH - 76, 420);
HomeRankDetailPopView *content = [[HomeRankDetailPopView alloc] initWithFrame:CGRectMake(0, 0, width, 460)];
NSString *title = d[@"title"] ?: @"High EQ";
NSString *people = d[@"people"] ?: @"Download: 1 Million";
NSString *desc = @"Be Neither Too Close\nNor Too Distant"; //
[content configWithAvatar:nil title:title download:people desc:desc];
//
LSTPopView *pop = [LSTPopView initWithCustomView:content
parentView:nil
popStyle:LSTPopStyleScale
dismissStyle:LSTDismissStyleScale];
pop.hemStyle = LSTHemStyleCenter; //
pop.bgColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
pop.isClickBgDismiss = YES; //
pop.cornerRadius = 0; // view
__weak typeof(pop) weakPop = pop;
content.saveHandler = ^{ [weakPop dismiss]; };
content.closeHandler = ^{ [weakPop dismiss]; };
[pop pop];
} }
#pragma mark - Lazy #pragma mark - Lazy

View File

@@ -22,10 +22,11 @@
[self.coverView mas_makeConstraints:^(MASConstraintMaker *make) { [self.coverView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.right.equalTo(self.contentView); make.left.top.right.equalTo(self.contentView);
// //
make.height.equalTo(self.contentView.mas_width).multipliedBy(0.58); // make.height.equalTo(self.contentView.mas_width).multipliedBy(0.58);
make.height.mas_equalTo(KBFit(264));
}]; }];
[self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView).offset(12); make.left.equalTo(self.contentView).offset(0);
make.top.equalTo(self.coverView.mas_bottom).offset(10); make.top.equalTo(self.coverView.mas_bottom).offset(10);
}]; }];
[self.rightLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {

View File

@@ -13,11 +13,11 @@
- (instancetype)initWithFrame:(CGRect)frame { - (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) { if (self = [super initWithFrame:frame]) {
self.contentView.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0]; self.contentView.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0];
self.contentView.layer.cornerRadius = 16; self.contentView.layer.cornerRadius = 12;
self.contentView.layer.masksToBounds = YES; self.contentView.layer.masksToBounds = YES;
[self.contentView addSubview:self.titleLabel]; [self.contentView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(6, 12, 6, 12)); make.edges.equalTo(self.contentView);
}]; }];
} }
return self; return self;
@@ -28,10 +28,10 @@
} }
+ (CGSize)sizeForText:(NSString *)text { + (CGSize)sizeForText:(NSString *)text {
if (text.length == 0) { return CGSizeMake(40, 32); } if (text.length == 0) { return CGSizeMake(40, 24); }
CGSize s = [text sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]}]; CGSize s = [text sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]}];
// 12 + 12 32 // 12 + 12 32
return CGSizeMake(ceil(s.width) + 24, 32); return CGSizeMake(ceil(s.width) + 24, 24);
} }
#pragma mark - Lazy #pragma mark - Lazy
@@ -39,8 +39,9 @@
- (UILabel *)titleLabel { - (UILabel *)titleLabel {
if (!_titleLabel) { if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init]; _titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:14]; _titleLabel.font = [UIFont systemFontOfSize:12];
_titleLabel.textColor = [UIColor colorWithHex:0x1B1F1A]; _titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
} }
return _titleLabel; return _titleLabel;
} }

View File

@@ -13,7 +13,7 @@
self.contentView.backgroundColor = [UIColor whiteColor]; self.contentView.backgroundColor = [UIColor whiteColor];
[self.contentView addSubview:self.titleLabel]; [self.contentView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView).offset(16); make.left.equalTo(self.contentView).offset(0);
make.centerY.equalTo(self.contentView); make.centerY.equalTo(self.contentView);
}]; }];
} }

View File

@@ -77,7 +77,7 @@ static NSString * const kInnerTagCellId = @"kInnerTagCellId";
UICollectionViewLeftAlignedLayout *layout = [UICollectionViewLeftAlignedLayout new]; UICollectionViewLeftAlignedLayout *layout = [UICollectionViewLeftAlignedLayout new];
layout.minimumInteritemSpacing = 8; layout.minimumInteritemSpacing = 8;
layout.minimumLineSpacing = 8; layout.minimumLineSpacing = 8;
layout.sectionInset = UIEdgeInsetsMake(8, 0, 8, 16); layout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
_tagsView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; _tagsView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
_tagsView.backgroundColor = [UIColor whiteColor]; _tagsView.backgroundColor = [UIColor whiteColor];

View File

@@ -122,12 +122,12 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
switch (indexPath.section) { switch (indexPath.section) {
case KBSkinDetailSectionHeader: { case KBSkinDetailSectionHeader: {
// = 0.58W + 56 // = 0.58W + 56
CGFloat h = contentW * 0.58 + 56; CGFloat h = KBFit(264) + 30;
return CGSizeMake(contentW, h); return CGSizeMake(contentW, h);
} }
case KBSkinDetailSectionTags: { case KBSkinDetailSectionTags: {
CGFloat h = [KBSkinTagsContainerCell heightForTags:self.tags width:W]; CGFloat h = [KBSkinTagsContainerCell heightForTags:self.tags width:W];
return CGSizeMake(contentW, h); return CGSizeMake(contentW, 25);
} }
case KBSkinDetailSectionTitle: { case KBSkinDetailSectionTitle: {
return CGSizeMake(contentW, 44); return CGSizeMake(contentW, 44);
@@ -144,7 +144,17 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
} }
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section { - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
return UIEdgeInsetsMake(12, 16, 12, 16); // Header Tags
switch (section) {
case KBSkinDetailSectionHeader:
// 12
return UIEdgeInsetsMake(12, 16, 4, 16);
case KBSkinDetailSectionTags:
// Header
return UIEdgeInsetsMake(14, 16, 5, 16);
default:
return UIEdgeInsetsMake(0, 16, 12, 16);
}
} }
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section { - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {

View File

@@ -78,7 +78,7 @@ typedef NS_ENUM(NSInteger, KBSearchSection) {
}]; }];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) { [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.topBar.mas_bottom).offset(12); make.top.equalTo(self.topBar.mas_bottom).offset(0);
make.left.right.bottom.equalTo(self.view); make.left.right.bottom.equalTo(self.view);
}]; }];
@@ -310,7 +310,7 @@ typedef NS_ENUM(NSInteger, KBSearchSection) {
if (section == KBSearchSectionHistory) { if (section == KBSearchSectionHistory) {
return UIEdgeInsetsMake(8, 16, 12, 16); return UIEdgeInsetsMake(8, 16, 12, 16);
} }
return UIEdgeInsetsMake(8, 16, 20, 16); return UIEdgeInsetsMake(8, 16, 16, 16);
} }
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section { - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
@@ -326,7 +326,7 @@ typedef NS_ENUM(NSInteger, KBSearchSection) {
if (section == KBSearchSectionHistory) { if (section == KBSearchSectionHistory) {
return self.historyWords.count == 0 ? CGSizeZero : CGSizeMake(collectionView.bounds.size.width, 40); return self.historyWords.count == 0 ? CGSizeZero : CGSizeMake(collectionView.bounds.size.width, 40);
} }
return CGSizeMake(collectionView.bounds.size.width, 40); return CGSizeMake(collectionView.bounds.size.width, 24);
} }
#pragma mark - UICollectionViewDelegate #pragma mark - UICollectionViewDelegate