0

I am working on ios app in that i want to implement 3d touch peak and pop in my collection view.for that i am using the below code

how to detect index path of a collection view while using 3d touch using objectiveC?

Larme
  • 24,190
  • 6
  • 51
  • 81
Munavvar
  • 11
  • 6
  • It doesn't call `collectionView:didSelectItemAtIndexPath:` or `collectionView:didHighlightItemAtAtIndexPath:`? Or according to this (https://engineering.instagram.com/posts/465414923641286/lessons-learned-with-3D-touch), it should call `previewingContext:viewControllerForLocation:`. Then you can retrieve the point: `UICollectionView *collectionView = (UICollectionView *)[previewingContext sourceView]; NSIndexPath *indexPath = [collectionView indexPathForItemAtPoint:location];` – Larme Jun 09 '16 at 11:29
  • Or look there: http://stackoverflow.com/questions/33002637/3d-touch-peek-and-pop-from-uitableviewcell-how-to-hand-over-data-to-other-uiview It's almost the same system between UICollectionView and UITableView do find the `NSIndexPath`. – Larme Jun 09 '16 at 11:31
  • Thanks a lot large for your valuable time and comment when i used the both code the app crashing. – Munavvar Jun 09 '16 at 11:52
  • If it crash, there should be an error message. – Larme Jun 09 '16 at 12:05
  • Thanks it worked for me after adding this line in did load [self registerForPreviewingWithDelegate:self sourceView:self.collectionview]; – Munavvar Jun 16 '16 at 11:35

0 Answers0