Skip to content

Commit

Permalink
Merge pull request #41 from alexsanderskywork/master
Browse files Browse the repository at this point in the history
Some changes
  • Loading branch information
alexanderkhitev committed Mar 10, 2016
2 parents 66125de + 69c6ca9 commit 162bfbb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion SKPhotoBrowser.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SKPhotoBrowser"
s.version = "1.6.3"
s.version = "1.6.4"
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" }
Expand Down
21 changes: 15 additions & 6 deletions SKPhotoBrowser/SKPhotoBrowser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,22 @@ 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.
if visiblePages.count > 0 {
let page = visiblePages[currentPageIndex]
page.frame = frameForPageAtIndex(currentPageIndex)
page.setMaxMinZoomScalesForCurrentBounds()
if page.captionView != nil {
page.captionView.frame = frameForCaptionView(page.captionView, index: currentPageIndex)
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)
}
}
}

Expand Down

0 comments on commit 162bfbb

Please sign in to comment.