首页直播中动效
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user