An easy to use library for fulscreen modal image presentation with zooming capability. Opened image could be dismissed by tap anywhere or swipe image too far from center. You could change background opacity and color, duration of showing, use or not bars stubs (see in examples).
Planned:
- Implement image sharing
- Horizontal orientation support
- Carthage support
To run the example project, clone the repo, and run pod install
from the Example directory first.
ModalImage is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ModalImage'
First of all add next import to your UIViewController
import ModalImage
and next call
showFullScreenImage(from: imageView)
And voila
Additionally you could change background color and opacity. Just add a couple of parameters
showFullScreenImage(from: imageView, Background(color: .yellow, alpha: 1))
And of course you could use it separately.
showFullScreenImage(from: imageView, Background(color: .yellow))
showFullScreenImage(from: imageView, Background(alpha: 1))
Default values for background color is black and for alpha is 0.6
Also you could change animation duration (in seconds).
showFullScreenImage(from: imageView, animationDuration: 1)
And you could change usage of Navigation Bar and TabBar stubs. Also you could change animation duration (in seconds).
showFullScreenImage(from: imageView, useNavbar: false)
showFullScreenImage(from: imageView, useTabbar: false)
There are some examples to show the difference.
Default values are true.
To use all together use next initializer
showFullScreenImage(from: imageView, animationDuration: 0.25, Background(color: .black, alpha: 0.6), useNavbar: true, useTabbar: true)
There is possibility to show blur background for an image.
showFullScreenImageWithBlur(from: imageView, animationDuration: 0.25, backgroundColor: .darkGray, backgroundAlpha: 1)
P.S. Don't use blur background with navbar and tabbar true flags.
ModalImage is available under the MIT license. See the LICENSE file for more info.