首页直播中动效

This commit is contained in:
chenshuanglin
2023-03-13 19:50:02 +08:00
parent a147c43450
commit 4463b2f551
9 changed files with 128 additions and 25 deletions

View File

@@ -16,6 +16,7 @@
#import "ThemeColor.h"
///View
#import "XPPartyListCollectionViewCell.h"
#import "XPHomeListEmptyCollectionViewCell.h"
///P
#import "XPHomePresenter.h"
#import "XPHomeProtocol.h"
@@ -164,14 +165,18 @@
#pragma mark - UICollectionViewDelegate
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.dataSource.count;
return self.dataSource.count > 0 ? self.dataSource.count : 1;
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
XPPartyListCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPPartyListCollectionViewCell class]) forIndexPath:indexPath];
HomeRecommendRoomModel *model = [self.dataSource safeObjectAtIndex1:indexPath.row];
cell.roomModel = model;
return cell;
if (self.dataSource.count > 0) {
XPPartyListCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPPartyListCollectionViewCell class]) forIndexPath:indexPath];
HomeRecommendRoomModel *model = [self.dataSource safeObjectAtIndex1:indexPath.row];
cell.roomModel = model;
return cell;
}
XPHomeListEmptyCollectionViewCell * emptyCell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPHomeListEmptyCollectionViewCell class]) forIndexPath:indexPath];
return emptyCell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
@@ -217,6 +222,7 @@
_collectionView.delegate = self;
_collectionView.dataSource = self;
[_collectionView registerClass:[XPPartyListCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPPartyListCollectionViewCell class])];
[_collectionView registerClass:[XPHomeListEmptyCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPHomeListEmptyCollectionViewCell class])];
}
return _collectionView;
}