TKImageShowing
- 点击图片查看全屏
要求
- iOS 10 或更高版本
- Xcode 8 或更高版本
📱 示例
要运行示例项目,请克隆仓库,然后从 Example 目录运行 pod install
使用 CocoaPods 安装
Podfile
platform :ios, '9.0'
pod 'TKImageShowing'
🔨 如何使用
Storyboard
在UICollectionView中显示图像列表
import UIKit
import TKImageShowing
let tkImageVC = TKImageShowing()
let arrImages = [
"https://www.gstatic.com/webp/gallery3/2.png",
"https://www.gstatic.com/webp/gallery3/3_webp_ll.png",
"https://www.gstatic.com/webp/gallery/2.jpg"
]
override func viewDidLoad() {
super.viewDidLoad()
tkImageVC.images = arrImages.toTKImageSource()
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let cell = collectionView.cellForItem(at: indexPath) as! ImageCell
self.tkImageVC.animatedView = cell.imageView
self.tkImageVC.currentIndex = indexPath.row
self.present(self.tkImageVC, animated: true, completion: nil)
}
作者
许可
所有源代码均采用MIT许可证许可。