ios3Dtouch照片预览

xiaoxiao2021-02-28  68

#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]; }
转载请注明原文地址: https://www.6miu.com/read-79292.html

最新回复(0)