diff --git a/README.md b/README.md index 780dcf5..21a90d9 100644 --- a/README.md +++ b/README.md @@ -147,13 +147,6 @@ let browser = SKPhotoBrowser(originImage: originImage, photos: images, animatedF browser.disableVerticalSwipe = true ``` -#### StatusBar -you can hide statusbar forcely using property: -``` swift -let browser = SKPhotoBrowser(originImage: originImage, photos: images, animatedFromView: cell) -browser.isForceStatusBarHidden = true -``` - #### Delegate There's some trigger point you can handle using delegate. those are optional. - didShowPhotoAtIndex(index:Int) @@ -181,6 +174,16 @@ func didDismissAtPageIndex(index: Int) { ``` +#### Minor Option +- blackArea handling which is appearing outside of photo +- single tap handling, dismiss/noaction +- bounce animation when appearing/dismissing +``` swift +enableZoomBlackArea = true // default true +enableSingleTapDismiss = true // default false +bounceAnimation = true // default false +``` + ## Photos from - [Unsplash](https://unsplash.com) diff --git a/SKPhotoBrowser/SKPhotoBrowser.swift b/SKPhotoBrowser/SKPhotoBrowser.swift index 8960035..3023a85 100644 --- a/SKPhotoBrowser/SKPhotoBrowser.swift +++ b/SKPhotoBrowser/SKPhotoBrowser.swift @@ -108,6 +108,7 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate { public var displayCustomDeleteButton = false public var bounceAnimation = false public var enableZoomBlackArea = true + public var enableSingleTapDismiss = false /// Set nil to force the statusbar to be hidden public var statusBarStyle: UIStatusBarStyle? @@ -662,7 +663,7 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate { 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 { + if displayCustomDeleteButton { customDeleteButtonShowFrame = CGRect(x: customDeleteButtonShowFrame.origin.y, y: customDeleteButtonShowFrame.origin.x, width: customDeleteButtonShowFrame.width, height: customDeleteButtonShowFrame.height) customDeleteButtonHideFrame = CGRect(x: customDeleteButtonHideFrame.origin.y, y: customDeleteButtonHideFrame.origin.x, width: customDeleteButtonHideFrame.width, height: customDeleteButtonHideFrame.height) } @@ -911,7 +912,7 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate { } } - private func determineAndClose() { + public func determineAndClose() { delegate?.willDismissAtPageIndex?(currentPageIndex) let scrollView = pageDisplayedAtIndex(currentPageIndex) diff --git a/SKPhotoBrowser/SKZoomingScrollView.swift b/SKPhotoBrowser/SKZoomingScrollView.swift index a5f3830..7ca8ba0 100644 --- a/SKPhotoBrowser/SKZoomingScrollView.swift +++ b/SKPhotoBrowser/SKZoomingScrollView.swift @@ -270,6 +270,9 @@ public class SKZoomingScrollView: UIScrollView, UIScrollViewDelegate, SKDetectin // MARK: - SKDetectingViewDelegate func handleSingleTap(view: UIView, touch: UITouch) { if photoBrowser?.enableZoomBlackArea == true { + if photoBrowser?.areControlsHidden() == false && photoBrowser?.enableSingleTapDismiss == true { + photoBrowser?.determineAndClose() + } photoBrowser?.toggleControls() } } @@ -304,6 +307,9 @@ public class SKZoomingScrollView: UIScrollView, UIScrollViewDelegate, SKDetectin // MARK: - SKDetectingImageViewDelegate func handleImageViewSingleTap(view: UIImageView, touch: UITouch) { + if photoBrowser?.areControlsHidden() == false && photoBrowser?.enableSingleTapDismiss == true { + photoBrowser?.determineAndClose() + } photoBrowser?.toggleControls() }