#pragma mark - peek的代理方法,轻按即可触发弹出vc
- (UIViewController *)previewingContext:(id )previewingContext viewControllerForLocation:(CGPoint)location{
//通过[previewingContext sourceView]拿到对应的cell的数据;
NSIndexPath *indexPath = [self.collectionView indexPathForCell:(UICollectionViewCell* )[previewingContext sourceView]];
// 用于显示预览的vc
PreviewViewController *vc = [[PreviewViewController alloc] init];
// 演示的是传入一个字符串 , 实际可能是你需要的model
vc.preferredContentSize = CGSizeMake(0,200);
return vc;
}
#pragma mark - pop的代理方法,在此处可对将要进入的vc进行处理
- (void)previewingContext:(id )previewingContext commitViewController:(UIViewController *)viewControllerToCommit
{
[self pushToMediaPreview:indexPath andNoAnimation:YES];
}
ios 3Dtouch 照片预览
最新推荐文章于 2020-12-07 20:56:20 发布