From fb034384b3620815c2323fca733d2f354156c87d Mon Sep 17 00:00:00 2001 From: Kevin Rummler Date: Mon, 14 Mar 2016 18:02:59 +0100 Subject: [PATCH] For for topOffset which I forgot, remove views when clearing cache, replace underlying image when closing --- SKPhotoBrowser/SKPhotoBrowser.swift | 4 +++- .../SKPhotoBrowserExample/ViewController.swift | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/SKPhotoBrowser/SKPhotoBrowser.swift b/SKPhotoBrowser/SKPhotoBrowser.swift index bd46884..afc2f45 100644 --- a/SKPhotoBrowser/SKPhotoBrowser.swift +++ b/SKPhotoBrowser/SKPhotoBrowser.swift @@ -511,6 +511,7 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate { updateToolbar() // reset local cache + visiblePages.forEach({$0.removeFromSuperview()}) visiblePages.removeAll() recycledPages.removeAll() @@ -594,7 +595,7 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate { /// This function changes buttons's frame after the rotation of the device private func frameForButton() { if displayDeleteButton == true { - deleteButtonShowFrame = CGRect(x: view.frame.width - 44, y: 5, width: 44, height: 44) + deleteButtonShowFrame = CGRect(x: view.frame.width - 44, y: buttonTopOffset, width: 44, height: 44) deleteButtonHideFrame = CGRect(x: view.frame.width - 44, y: -20, width: 44, height: 44) } if displayCustomDeleteButton == true { @@ -814,6 +815,7 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate { fadeView.alpha = 1.0 applicationWindow.addSubview(fadeView) + resizableImageView.image = scrollView.photo.underlyingImage resizableImageView.frame = frame resizableImageView.alpha = 1.0 resizableImageView.clipsToBounds = true diff --git a/SKPhotoBrowserExample/SKPhotoBrowserExample/ViewController.swift b/SKPhotoBrowserExample/SKPhotoBrowserExample/ViewController.swift index 29c6020..40dc8d5 100644 --- a/SKPhotoBrowserExample/SKPhotoBrowserExample/ViewController.swift +++ b/SKPhotoBrowserExample/SKPhotoBrowserExample/ViewController.swift @@ -76,6 +76,7 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection let browser = SKPhotoBrowser(originImage: originImage, photos: images, animatedFromView: cell) browser.initializePageIndex(indexPath.row) browser.delegate = self + browser.displayDeleteButton = true browser.statusBarStyle = .LightContent browser.bounceAnimation = true @@ -114,7 +115,7 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection } func removePhoto(browser: SKPhotoBrowser, index: Int, reload: (() -> Void)) { - // do some handle if you need + reload() } func viewForPhoto(browser: SKPhotoBrowser, index: Int) -> UIView? {