/WYPhotoBrowser

图片浏览器

Primary LanguageObjective-CMIT LicenseMIT

WYPhotoBrowser

图片浏览器

封装逻辑

  • WYPhotoBrowserViewController负责展示图片,每张图片是一个WYPhoto对象
  • WYPhotoBrowserTransition是展示和消失的动画的基类

安装

pod 'WYPhotoBrowser'

使用方法

  • Step1: 根据图片数组生成WYPhotoBrowserViewController对象
  • Step2: 指定数据源 dataSource
  • Step3: 调用 presentViewController:animated:completion:pushViewController:animated:弹出vc
  • Step4: 实现协议WYPhotoBrowserViewControllerDataSource
  NSInteger index = xxx;
  WYPhotoBrowserViewController *vc = [[WYPhotoBrowserViewController alloc] initWithPhotos:self.photos];
  vc.dataSource = self;
  vc.currentIndex = index;
  [self presentViewController:vc animated:YES completion:nil];
#pragma mark - WYPhotoBrowserViewControllerDataSource

- (CGRect)photoBrowserViewController:(WYPhotoBrowserViewController *)browserViewController sourceViewFrameAtScreenForIndex:(NSInteger)index {
  NSInteger tag = index + yyyyy;
  UIView *imgView = [self.view viewWithTag:xxxxx];
  return [self.view convertRect:imgView toView:[UIApplication sharedApplication].keyWindow];
}

如何扩展

您可以继承WYPhotoBrowserTransition继续给WYPhotoBrowserViewController添加动画效果

开始项目贡献

  • 如果您想对该项目有所贡献,可以fork我的项目,并将https://github.com/DouKing/WYPhotoBrowser.git添加到您的远程仓库
  • 如果您对该项目有任何疑问或建议,请给我留言,希望我们能携手打造出强大好用的图片浏览器