// // QXGiftWallSubViewController.m // QXLive // // Created by 启星 on 2025/11/5. // #import "QXGiftWallSubViewController.h" #import "QXMineGiftWallCell.h" @interface QXGiftWallSubViewController () @property (nonatomic,strong)UICollectionView *collectionView; @end @implementation QXGiftWallSubViewController -(UIView *)listView{ return self.view; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. } - (void)initSubViews{ self.bgImageHidden = YES; UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; int itemWidth = (SCREEN_WIDTH-16*2-12*2)/3; layout.itemSize = CGSizeMake(itemWidth, ScaleWidth(143)); layout.minimumLineSpacing = 12; layout.minimumInteritemSpacing = 12; layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16); layout.scrollDirection = UICollectionViewScrollDirectionVertical; self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; [self.collectionView registerNib:[UINib nibWithNibName:@"QXMineGiftWallCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXMineGiftWallCell"]; self.collectionView.delegate = self; self.collectionView.dataSource = self; self.collectionView.showsHorizontalScrollIndicator = NO; self.collectionView.bounces = NO; self.collectionView.pagingEnabled = NO; self.collectionView.backgroundColor = [UIColor clearColor]; [self.view addSubview:self.collectionView]; [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.top.mas_equalTo(0); make.bottom.mas_equalTo(0); make.right.mas_equalTo(0); }]; } -(void)setGiftArray:(NSArray *)giftArray{ _giftArray = giftArray; [self.collectionView reloadData]; } -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ return self.giftArray.count; } -(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ QXMineGiftWallCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXMineGiftWallCell" forIndexPath:indexPath]; cell.isLight = self.isLight; cell.model = self.giftArray[indexPath.row]; return cell; } @end