PhotoBrowserKit 0.1.8

PhotoBrowserKit 0.1.8

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最新发布2018年1月
SwiftSwift 版本3.0
SPM支持 SPM

smalldu 维护。



  • smalldu

PhotoBrowserKit

CI Status
Version
License
Platform

简介

此项目高度模仿自 KSPhotoBrowser - 一个 Objective-C 项目
,我只是使用 Swift 重写了部分功能

它很智能,很棒!

demo

示例

要运行示例项目,克隆仓库,然后首先在示例目录中运行 pod install

要求

此库需要 iOS 8.0+ 和 Xcode 8.0+。

安装

PhotoBrowserKit 通过 CocoaPods 可用。要安装它,只需将以下行添加到您的 Podfile 中:

pod "PhotoBrowserKit"

使用方法

var items: [ZYPhotoItem] = []
for i in 0..<urls.count {
  let cell = collectionView.cellForItem(at: IndexPath(row: i, section: 0)) as? PhotoCell
  // big url
  let bigUrl = urls[i].replacingOccurrences(of: "bmiddle", with: "large")
  let item = ZYPhotoItem()
  // imageView
  item.sourceView = cell?.imageView
  item.imageURL = URL(string: bigUrl)
  item.thunbImage = cell?.imageView.image
  items.append(item)
}
let browser = ZYPhotoBrowser(photoItems: items, selectedIndex: indexPath.row)
browser.showFromViewController(self)

作者

smalldu, [email protected]

许可证

PhotoBrowserKit 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。