lxcid/LXReorderableCollectionViewFlowLayout

UICollectionViewController vs UICollectionView

Closed this issue · 3 comments

I'm new to Obj-C and GitHub. But I've been trying to use this framework on a UICollectionView and not on a UICollectionViewController. My array is manually entered. I have the layout folder in my project and as far as I know it is hooked up correctly. The UICollectionView renders and scrolls but gestures are not recognized. I was wondering if I have to use cellForItemAtIndexPath in a similar manner as you did or is the layout code all that needs to be added?

-(UICollectionViewCell *)collectionView:(UICollectionView *)sortCollectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *SortCellIndentifier = @"SortCell";
SortCell *cell = [sortCollectionView dequeueReusableCellWithReuseIdentifier:SortCellIndentifier forIndexPath:indexPath];
[[cell sortImage]setImage:[UIImage imageNamed:[self.sortArrayOfImages objectAtIndex:indexPath.item]]];
return cell;

}

-(void)collectionView:(UICollectionView *)sortCollectionView layout:(UICollectionViewLayout *)theLayout itemAtIndexPath:(NSIndexPath *)indexPath willMoveToIndexPath:(NSIndexPath *)theToIndexPath {
id theFromItem = [self.sortArrayOfImages objectAtIndex:indexPath.item];
[self.sortArrayOfImages removeObjectAtIndex:indexPath.item];
[self.sortArrayOfImages insertObject:theFromItem atIndex:indexPath.item];
}

Hi there, if the gesture is not recognize, the likely explanation is that you might not be using reordering layout here.

Could you double check your collection view layout is using it?

Hi, its been more than a week since I last responded and the thread is not moving. I'm closing it for now.

Ok, I still have not tried everything. I will get back to you and let you know how I do. Thanks.