For for topOffset which I forgot, remove views when clearing cache, replace underlying image when closing

This commit is contained in:
Kevin Rummler 2016-03-14 18:02:59 +01:00
parent 2926e31d7f
commit fb034384b3
2 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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? {