VKHImageViewer 1.0.2

VKHImageViewer 1.0.2

Vlad Khodiachiy 维护。



VKHImageViewer

Swift 中的简单图像/照片浏览器。

VKHImageViewer

sample

安装

CocoaPods

在 CocoaPods 上可用。只需将以下内容添加到您的项目 Podfile 中

pod 'VKHImageViewer'

手动

VKHImageViewer.swiftVKHImageViewController.swift 文件添加到您的项目中。

用法

在Swift文件顶部添加import VKHImageViewer

在viewController中

let imagesArray = [UIImage(named:"*.*"), "https://www.*.*/*.jpg", URL(string: "https://www.*.*/*.png")] as [AnyObject]

let arrayNames = ["one","two","three"]
let pageVC = VKHImageViewer(names: arrayNames, images: imagesArray)
pageVC.modalPresentationStyle = .overCurrentContext
pageVC.placeHolderImage = UIImage(named: "error-icon.png")

present(pageVC, animated: true, completion: nil)

对于图像数组,可以使用

https://www.*.*/*.jpg - 字符串URL,
URL(string:"https://www.*.*/*.jpg" - URL,
UIImage(named:"*.*") - UIImage。

如果想要为所有图像使用同一个名称,那么

let pageV = VKHImageViewer(name: "name", images: imagesArray)

如果需要设置起始索引(默认为0),则使用

let page = VKHImageViewer(name: "name", images: imagesArray, currentIndex: 2)

let page = VKHImageViewer(names: arrayNames, images: imagesArray, currentIndex: 2)

自定义

pageVC.textColor: UIColor = .white      // Set text color for Labels. Default is white.
pageVC.backgroundColor: UIColor = .black        //Set background color for viewController. Default is black.
pageVC.placeHolderImage: UIImage?       //If for some reason it is not possible to display a picture, it will be replaced by this.
pageVC.displayStatusBar: Bool = false       //Set status bar visibility. Default is false.
pageVC.displayNameLabel: Bool = true        //Set name label visibility. Default is true.
pageVC.displayCountLabel: Bool = true       //Set count label visibility. Default is true.

作者

许可

此项目受MIT许可证的许可 - 有关详情,请参阅LICENSE.md文件

示例旋转

sample