一个非常简单的具有缩放的 IBDesignable ImageView
安装
只需将 EFImageViewZoom.swift
拖动到您的项目中。
CocoaPods
您可以通过将 EFImageViewZoom
添加到您的 Podfile
中,使用 CocoaPods 来安装 EFImageViewZoom
use_frameworks!
pod 'EFImageViewZoom', :git => 'https://github.com/ezefranca/EFImageViewZoom.git'
如何使用
只需在 Storyboard 中将一个 UIView 设置为 EFImageViewZoom
类型。
import UIKit
class ViewController: UIViewController, EFImageViewZoomDelegate {
@IBOutlet weak var imageViewZoom: EFImageViewZoom!
override func viewDidLoad() {
super.viewDidLoad()
self.imageViewZoom._delegate = self
self.imageViewZoom.image = UIImage(named: "14bis.png")
self.imageViewZoom.contentMode = .left
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
设置
可选地,您可以设置一些UIImageView的属性
@IBInspectable public var image: UIImage!
@IBInspectable public var _minimumZoomScale: CGFloat = 1.0
@IBInspectable public var _maximumZoomScale: CGFloat = 6.0
public var highlightedImage: UIImage? = nil
public var isHighlighted: Bool = false
public var animationImages: [UIImage]? = nil
public var highlightedAnimationImages: [UIImage]? = nil
public var animationDuration: TimeInterval = TimeInterval()
public var animationRepeatCount: Int = 0
override public var tintColor: UIColor!
public func startAnimating()
public func stopAnimating()
public var isAnimating: Bool
示例
感谢
双击以恢复建议 @avilarenan
许可
EFImageViewZoom遵从MIT许可。更多信息请查阅LICENSE文件。