A reusable control to replace UIImageView
and enable images to zoom in/out. Used in AGPhotoBrowser photo browser and now it's written in Swift.
- copy the content of the 'DTZoomableView' folder in your project
- import
DTZoomableView.swift
in your class
Example usage:
let zoomableView: DTZoomableView = DTZoomableView(frame: CGRectMake(10, 100, 300, 300)) zoomableView.image = UIImage(named: "sample_image") self.view.addSubview(zoomableView)
You can enabled/disable zoom capability by calling the corresponding function...
zoomableView.setZoomEnabled(false)
...or check if zoom is enabled.
if zoomableView.isZoomEnabled() { ... }