I have a UICollectionView
with 5 sections, some sections have data and some sections (in my code it is section 2) doesn't have (it depend on sever)
Therefore, I want to display a label ("No item") in the selection that doesn't data.
However, I can find any idea to do that, I hope anyone can give me some suggestion or instruction to achieve it.
I would really appreciate any help
Here is my code for intergrade sections
-(UICollectionReusableView *) collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
FriendsFanLevelHeaderView *headerView = (FriendsFanLevelHeaderView *)[self.collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"FanLevelHeader" forIndexPath:indexPath];
switch (indexPath.section) {
case 0:
[headerView.lblFanLevelTitle setText:@"Gold"];
break;
case 1:
[headerView.lblFanLevelTitle setText:@"Silver"];
break;
case 2:
[headerView.lblFanLevelTitle setText:@"Bronze"];
break;
case 3:
[headerView.lblFanLevelTitle setText:@"Green"];
break;
case 4:
[headerView.lblFanLevelTitle setText:@"Other"];
break;
default:
break;
}
return headerView;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
switch (section) {
case 0:
return 3;
case 1:
return 0; // it doesn't have any item
case 2:
return 2;
case 3:
return 3;
case 4:
return 5;
default:
return 0;
}
}
- (FriendsCollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
FriendsCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"FriendsCollectionViewCell" forIndexPath:indexPath];
[cell.lblFriendBand setText:@"Band: White Mash "];
[cell.lblFriendGenre setText:@"Freestyle house, House, Freestyle music,"];
[cell.lblFriendECScore setText:@"EC score: 79"];
return cell;
}
============================================
HERE IS WHAT I WANT