From d9367496cca14cb7013f3ff103e9b2ea5f03cb5e Mon Sep 17 00:00:00 2001 From: Alexsandersky Date: Fri, 11 Mar 2016 06:59:55 +0400 Subject: [PATCH 1/2] more stability --- SKPhotoBrowser/SKPhotoBrowser.swift | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/SKPhotoBrowser/SKPhotoBrowser.swift b/SKPhotoBrowser/SKPhotoBrowser.swift index 40fe739..1bf1beb 100644 --- a/SKPhotoBrowser/SKPhotoBrowser.swift +++ b/SKPhotoBrowser/SKPhotoBrowser.swift @@ -277,21 +277,14 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate { pagingScrollView.frame = frameForPagingScrollView() pagingScrollView.contentSize = contentSizeForPagingScrollView() //If we open the SKPhotoBrowser from CollectionView not the first image, we have one element in visiblepages and we should to take 0 element from visibleindex but that we should to use frame we should use currentPageIndex for frame's functions. + // TODO: - need to fix this bug if visiblePages.count > 0 { - if visiblePages.count == 1 { - let page = visiblePages[0] - page.frame = frameForPageAtIndex(currentPageIndex) - page.setMaxMinZoomScalesForCurrentBounds() - if page.captionView != nil { - page.captionView.frame = frameForCaptionView(page.captionView, index: currentPageIndex) - } - } else { - let page = visiblePages[currentPageIndex] - page.frame = frameForPageAtIndex(currentPageIndex) - page.setMaxMinZoomScalesForCurrentBounds() - if page.captionView != nil { - page.captionView.frame = frameForCaptionView(page.captionView, index: currentPageIndex) - } + let currentIndex = visiblePages.count - 1 + let page = visiblePages[currentIndex] + page.frame = frameForPageAtIndex(currentPageIndex) + page.setMaxMinZoomScalesForCurrentBounds() + if page.captionView != nil { + page.captionView.frame = frameForCaptionView(page.captionView, index: currentIndex) } } From dd4e0a643d462bc4955249dbb543ac942334a366 Mon Sep 17 00:00:00 2001 From: Alexsandersky Date: Fri, 11 Mar 2016 07:01:34 +0400 Subject: [PATCH 2/2] More stability --- SKPhotoBrowser.podspec | 2 +- SKPhotoBrowser/SKPhotoBrowser.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SKPhotoBrowser.podspec b/SKPhotoBrowser.podspec index d5c0938..976fc0d 100644 --- a/SKPhotoBrowser.podspec +++ b/SKPhotoBrowser.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SKPhotoBrowser" - s.version = "1.6.4" + s.version = "1.6.5" s.summary = "Simple PhotoBrowser/Viewer inspired by facebook, twitter photo browsers written by swift2.0." s.homepage = "https://github.com/suzuki-0000/SKPhotoBrowser" s.license = { :type => "MIT", :file => "LICENSE" } diff --git a/SKPhotoBrowser/SKPhotoBrowser.swift b/SKPhotoBrowser/SKPhotoBrowser.swift index 1bf1beb..4ec28fa 100644 --- a/SKPhotoBrowser/SKPhotoBrowser.swift +++ b/SKPhotoBrowser/SKPhotoBrowser.swift @@ -277,7 +277,7 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate { pagingScrollView.frame = frameForPagingScrollView() pagingScrollView.contentSize = contentSizeForPagingScrollView() //If we open the SKPhotoBrowser from CollectionView not the first image, we have one element in visiblepages and we should to take 0 element from visibleindex but that we should to use frame we should use currentPageIndex for frame's functions. - // TODO: - need to fix this bug + // TODO: - need to fix this bug if visiblePages.count > 0 { let currentIndex = visiblePages.count - 1 let page = visiblePages[currentIndex]