lxcid / LXReorderableCollectionViewFlowLayout

Extends `UICollectionViewFlowLayout` to support reordering of cells. Similar to long press and pan on books in iBook.
http://lxcid.com/
MIT License
1.86k stars 328 forks source link

UICollectionViewController vs UICollectionView #12

Closed JTylerGary closed 11 years ago

JTylerGary commented 11 years ago

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]; }

lxcid commented 11 years ago

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?

lxcid commented 11 years ago

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

JTylerGary commented 11 years ago

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