111 lines
4.1 KiB
Objective-C
111 lines
4.1 KiB
Objective-C
//
|
|
// QXPropShopSubVC.m
|
|
// QXLive
|
|
//
|
|
// Created by 启星 on 2026/1/3.
|
|
//
|
|
|
|
#import "QXPropShopSubVC.h"
|
|
#import "QXGiftPlayerManager.h"
|
|
#import "QXDressShopCell.h"
|
|
#import "QXMineNetwork.h"
|
|
#import "QXDressShopBuyView.h"
|
|
#import "QXRechargeViewcController.h"
|
|
@interface QXPropShopSubVC ()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,QXDressShopBuyViewDelegate>
|
|
@property (nonatomic,strong)UICollectionView *collectionView;
|
|
@property (nonatomic,strong)QXEffectContentView *fullEffectView;
|
|
@end
|
|
|
|
@implementation QXPropShopSubVC
|
|
-(UIView *)listView{
|
|
return self.view;
|
|
}
|
|
-(void)listWillAppear{
|
|
[self getDressList];
|
|
}
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
// Do any additional setup after loading the view.
|
|
}
|
|
-(void)initSubViews{
|
|
self.bgImageHidden = YES;
|
|
|
|
[self.view addSubview:self.collectionView];
|
|
[self.view addSubview:self.fullEffectView];
|
|
}
|
|
-(void)viewDidLayoutSubviews{
|
|
[super viewDidLayoutSubviews];
|
|
self.collectionView.frame = CGRectMake(0, 12, SCREEN_WIDTH, self.view.height);
|
|
}
|
|
-(void)getDressList{
|
|
@weakify(self)
|
|
[QXMineNetwork shopDressListWithType:self.model.id successBlock:^(NSArray<QXShopDressModel *> * _Nonnull list) {
|
|
@strongify(self);
|
|
[self.dataArray removeAllObjects];
|
|
[self.dataArray addObjectsFromArray:list];
|
|
[self.collectionView reloadData];
|
|
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
|
|
|
}];
|
|
}
|
|
|
|
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
|
return self.dataArray.count;
|
|
}
|
|
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
|
QXDressShopCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXDressShopCell" forIndexPath:indexPath];
|
|
cell.model = self.dataArray[indexPath.row];
|
|
return cell;
|
|
}
|
|
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
|
|
int width = (SCREEN_WIDTH-15*2-15*2-1)/3;
|
|
return CGSizeMake((int)width, (int)width-20+87);
|
|
}
|
|
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
|
QXShopDressModel *model = self.dataArray[indexPath.row];
|
|
QXDressShopBuyView *buyView = [[QXDressShopBuyView alloc] init];
|
|
buyView.typeId = self.model.id;
|
|
buyView.model = model;
|
|
buyView.delegate = self;
|
|
[buyView showInView:KEYWINDOW];
|
|
}
|
|
|
|
-(void)didClickRecharge{
|
|
QXRechargeViewcController *vc = [[QXRechargeViewcController alloc] init];
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
}
|
|
-(UICollectionView *)collectionView{
|
|
if (!_collectionView) {
|
|
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
|
layout.minimumLineSpacing = 15;
|
|
layout.minimumInteritemSpacing = 15;
|
|
layout.sectionInset = UIEdgeInsetsMake(0, 15, 0, 15);
|
|
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
|
_collectionView.delegate = self;
|
|
_collectionView.dataSource = self;
|
|
_collectionView.backgroundColor = [UIColor clearColor];
|
|
[_collectionView registerNib:[UINib nibWithNibName:@"QXDressShopCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXDressShopCell"];
|
|
}
|
|
return _collectionView;
|
|
}
|
|
|
|
- (QXEffectContentView *)fullEffectView {
|
|
if (!_fullEffectView) {
|
|
_fullEffectView = [[QXEffectContentView alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
_fullEffectView.queue = dispatch_queue_create("qx_room_full_preview_message.com", NULL);
|
|
_fullEffectView.hidden = YES;
|
|
}
|
|
return _fullEffectView;
|
|
}
|
|
/*
|
|
#pragma mark - Navigation
|
|
|
|
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
|
// Get the new view controller using [segue destinationViewController].
|
|
// Pass the selected object to the new view controller.
|
|
}
|
|
*/
|
|
|
|
@end
|