add a delegate to notify when the user scroll to an index

This commit is contained in:
Philippe Riegert 2016-05-27 21:45:46 -04:00
parent e1fba6eae5
commit 933d7726a4
1 changed files with 11 additions and 1 deletions

View File

@ -45,7 +45,14 @@ import UIKit
- Parameter photoIndex: the index of the current photo
*/
optional func didDismissActionSheetWithButtonIndex(buttonIndex: Int, photoIndex: Int)
/**
Tells the delegate that the browser did scroll to index
- Parameter index: the index of the photo where the user had scroll
*/
optional func didScrollToIndex(index: Int)
/**
Tells the delegate the user removed a photo, when implementing this call, be sure to call reload to finish the deletion process
@ -1256,6 +1263,9 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
public func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
hideControlsAfterDelay()
let currentIndex = self.pagingScrollView.contentOffset.x / self.pagingScrollView.frame.size.width
self.delegate?.didScrollToIndex?(Int(currentIndex))
}
public func scrollViewDidEndScrollingAnimation(scrollView: UIScrollView) {