I am create an application like Photo album in iPhone.
Can any one tell me that how can I add functionality for multiple selection for specific section in UICollectionView?
I am using this code:
[self.collectionView setAllowsMultipleSelection:YES];
but, the above code will affects all sections.
Please suggest me any solution?
Tarun Kumar
23-Dec-2015The code I am providing here it will allow multiple selection only at section 1 and will allow only one cell selected at any other section:
For Example:
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {if(indexPath.section == 1) return;
NSArray<NSIndexPath*>* indexNo = collectionView.indexPathsForSelectedItems;
for (int i = 0; i<indexNo.count; i++) {
NSIndexPath* currentIndex = indexNo[i];
if(![currentIndex isEqual:indexPath] && currentIndex.section != 1) {
[collectionView deselectItemAtIndexPath:currentIndex animated:YES];
}
}
}