Created
December 2, 2015 15:55
-
-
Save kubbing/da2143049309f54b6b28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext | |
viewControllerForLocation:(CGPoint)location | |
{ | |
// query the collectionView for index corresponting to the touch location | |
NSIndexPath *indexPath = [self.collectionView indexPathForItemAtPoint:location]; | |
// just in case | |
if (!indexPath) { return nil; } | |
// get the data object corresponding to the pressed cell | |
HNMemberLite *lite = self.memberService.members[indexPath.row]; | |
// filter out non member objects (aka ads) | |
if (![lite isKindOfClass:[HNMemberLite class]]) { return nil; } | |
// set the source rectangle for proper animation | |
CGRect rect = [self.collectionView layoutAttributesForItemAtIndexPath:indexPath].frame; | |
[previewingContext setSourceRect:rect]; | |
// instantiate the peek controller and return it | |
UIViewController *controller = [[HNTMemberPeekViewController alloc] initWithMember:lite]; | |
return controller; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment