添加弹窗

This commit is contained in:
2025-11-11 14:38:38 +08:00
parent e4ba237a00
commit 57bd4ba109
8 changed files with 338 additions and 8 deletions

View File

@@ -7,6 +7,8 @@
@import UIKit;
#import "HomeRankContentVC.h"
#import "HomeRankDetailPopView.h" //
#import "LSTPopView.h" // LSTPopView
// Cell
#import "HomeRankCardCell.h"
@@ -92,16 +94,44 @@
#pragma mark - UICollectionViewDelegateFlowLayout
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
CGFloat totalHInset = 16 + 16; // section i/l/r
CGFloat spacing = 16; // interitem spacing
CGFloat w = collectionView.bounds.size.width - totalHInset; // not including section insets yet
// Two columns each width = (width - spacing - lr insets)/2
CGFloat totalHInset = 16 + 16;
CGFloat spacing = 16;
CGFloat w = collectionView.bounds.size.width - totalHInset;
CGFloat cellWidth = (w - spacing) / 2.0;
//
CGFloat cellHeight = 234.0;
return CGSizeMake(floor(cellWidth), cellHeight);
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
// ->
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 - JXCategoryListContentViewDelegate
- (UIView *)listView {