1
격자보기와 같은 uicollectionview에서 다중 이미지가 있습니다. 한 번에 여러 이미지를 선택하고 싶지만이 코드에 대한 아이디어를주는 코드는 없습니다.uicollectionview에서 다중 선택이 작동하지 않습니다.
나는 이미이 코드를 시도했지만 작동하지 않습니다.
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath: (NSIndexPath *)indexPath
{
NSMutableArray *indexPaths = [NSMutableArray arrayWithObject:indexPath];
if (self.selectedItemIndexPath)
{
// if we had a previously selected cell
if ([indexPath compare:self.selectedItemIndexPath] == NSOrderedSame)
{
// if it's the same as the one we just tapped on, then we're unselecting it
self.selectedItemIndexPath = nil;
}
else
{
// if it's different, then add that old one to our list of cells to reload, and
// save the currently selected indexPath
[indexPaths addObject:self.selectedItemIndexPath];
self.selectedItemIndexPath = indexPath;
}
}
else
{
// else, we didn't have previously selected cell, so we only need to save this indexPath for future reference
self.selectedItemIndexPath = indexPath;
}
// and now only reload only the cells that need updating
[self.collectionView reloadItemsAtIndexPaths:indexPaths];
}
단 하나의 선택이 다중 선택에서 작동하지 않는 근무이 코드. – user3331020
누구든지이 질문에 대한 해결책을주십시오. – user3331020
나는이 질문에 대한 해결책을 누군가에게 주길 바랍니다. – user3331020