more stability

This commit is contained in:
Alexsandersky 2016-03-11 06:59:55 +04:00
parent 162bfbb2c6
commit d9367496cc
1 changed files with 7 additions and 14 deletions

View File

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