diff --git a/Agrume.podspec b/Agrume.podspec index c9454e1..55eb211 100644 --- a/Agrume.podspec +++ b/Agrume.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "Agrume" - s.version = "5.0.3" + s.version = "5.1.0" s.summary = "An iOS image viewer written in Swift." s.swift_version = "4.1" diff --git a/Agrume/AgrumeOverlayView.swift b/Agrume/AgrumeOverlayView.swift index 32fffd9..79ec6f9 100644 --- a/Agrume/AgrumeOverlayView.swift +++ b/Agrume/AgrumeOverlayView.swift @@ -23,7 +23,8 @@ final class AgrumeOverlayView: UIView { }() private lazy var navigationItem = UINavigationItem(title: "") - private lazy var defaultCloseButton = UIBarButtonItem(title: "Close", style: .plain, target: self, action: #selector(close)) + private lazy var defaultCloseButton = UIBarButtonItem(title: NSLocalizedString("Close", comment: "Close image view"), + style: .plain, target: self, action: #selector(close)) init(closeButton: UIBarButtonItem?) { super.init(frame: .zero) diff --git a/README.md b/README.md index 592fed0..594bcfd 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,23 @@ let agrume = Agrume(images: images) Remote animated gifs (i.e. using the url or urls initializer) are supported. Agrume does the image type detection and displays them properly. If using Agrume from a custom `UIImageView` you may need to rebuild the `UIImage` using the original data to preserve animation vs. using the `UIImage` instance from the image view. +### Close Button + +Per default you dismiss the zoomed view by dragging/flicking the image off screen. You can opt out of this behaviour and instead display a close button. To match the look and feel of your app you can pass in a custom `UIBarButtonItem`: + +```swift + +// Default button that displays NSLocalizedString("Close", …) +let agrume = Agrume(image: UIImage(named: "…")!, .dismissal: .withButton(nil)) +// Customise the button any way you like. For example display a system "x" button +let button = UIBarButtonItem(barButtonSystemItem: .stop, target: nil, action: nil) +button.tintColor = .red +let agrume = Agrume(image: UIImage(named: "…")!, .dismissal: .withButton(button)) + +``` + +The included sample app shows both cases for reference. + ### Custom Download Handler If you want to take control of downloading images (e.g. for caching), you can also set a download closure that calls back to Agrume to set the image. For example, let's use [MapleBacon](https://github.com/JanGorman/MapleBacon).