仿Instagram 图片预览效果

2020-04-24  本文已影响0人  有毒的程序猿

1.效果图

YHPinchPhotoBrowser.gif

2.使用方法

// 导入头文件
#import "UIViewController+YHPinchPhotoBrowser.h"

__weak typeof(self) weakSelf = self;
self.yhPhotoBrowser.bz_dataSource = ^(UIPinchGestureRecognizer * _Nonnull recognizer, LocationInTarget  _Nonnull locationInTarget) {
       if (locationInTarget) {
           locationInTarget(weakSelf.sinleImageView);
       }
   };
__weak typeof(self) weakSelf = self;
  self.yhPhotoBrowser.bz_dataSource = ^(UIPinchGestureRecognizer * _Nonnull recognizer, LocationInTarget  _Nonnull locationInTarget) {
      [weakSelf locationInImageView:recognizer locationInTarget:locationInTarget];
  };
  
- (void)locationInImageView:(UIPinchGestureRecognizer*)recognizer
         locationInTarget:(LocationInTarget)locationInTarget {
  CGPoint locationTable = [recognizer locationInView:self.tableView];
  NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:locationTable];
  YHImageTableViewCell *targetCell = (YHImageTableViewCell *)[self.tableView cellForRowAtIndexPath:indexPath];
  UIImageView *imgeView = [targetCell getCurrentImageView];
  if (locationInTarget) {
      locationInTarget(imgeView);
  }
}

3.demo地址

上一篇 下一篇

猜你喜欢

热点阅读