Merge branch 'master' of https://github.com/suzuki-0000/SKPhotoBrowser into cameraroll

# Conflicts:
#	SKPhotoBrowserExample/SKPhotoBrowserExample.xcodeproj/project.pbxproj
This commit is contained in:
Kevin Rummler 2016-03-14 13:32:57 +01:00
commit d46275e705
6 changed files with 124 additions and 129 deletions

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SKPhotoBrowser"
s.version = "1.6.5"
s.version = "1.6.9"
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" }

View File

@ -15,6 +15,7 @@ import UIKit
optional func didDismissAtPageIndex(index: Int)
optional func didDismissActionSheetWithButtonIndex(buttonIndex: Int, photoIndex: Int)
optional func removePhoto(browser: SKPhotoBrowser, index: Int, reload: (() -> Void))
optional func viewForPhoto(browser: SKPhotoBrowser, index: Int) -> UIView?
}
public let SKPHOTO_LOADING_DID_END_NOTIFICATION = "photoLoadingDidEndNotification"
@ -53,8 +54,10 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
public var isForceStatusBarHidden: Bool = false
public var displayDeleteButton = false
public var displayCloseButton = true // default is true
public var displayCustomCloseButton = false // if it is true displayCloseButton will be false
public var displayCustomDeleteButton = false // if it is true displayDeleteButton will be false
/// If it is true displayCloseButton will be false
public var displayCustomCloseButton = false
/// If it is true displayDeleteButton will be false
public var displayCustomDeleteButton = false
public var bounceAnimation = false
public var enableZoomBlackArea = true
@ -73,8 +76,8 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
private var panGesture: UIPanGestureRecognizer!
// MARK: close button
private var closeButton: UIButton!
private var closeButtonShowFrame: CGRect! //= CGRect(x: 5, y: 5, width: 44, height: 44)
private var closeButtonHideFrame: CGRect! //= CGRect(x: 5, y: -20, width: 44, height: 44)
private var closeButtonShowFrame: CGRect!
private var closeButtonHideFrame: CGRect!
// MARK: delete button
private var deleteButton: UIButton!
private var deleteButtonShowFrame: CGRect!
@ -87,8 +90,6 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
public var customCloseButtonHideFrame: CGRect!
public var customCloseButtonImage: UIImage!
public var customCloseButtonEdgeInsets: UIEdgeInsets!
private var customCloseButtonHideOldFrame: CGRect!
private var customCloseButtonShowOldFrame: CGRect!
// MARK: CustomDeleteButton
private var customDeleteButton: UIButton!
@ -99,6 +100,8 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
// photo's paging
private var visiblePages = [SKZoomingScrollView]()//: Set<SKZoomingScrollView> = Set()
private var recycledPages = [SKZoomingScrollView]()
private var initialPageIndex: Int = 0
private var currentPageIndex: Int = 0
@ -115,7 +118,6 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
private var isViewActive: Bool = false
private var isPerformingLayout: Bool = false
private var isStatusBarOriginallyHidden: Bool = false
private var startOrientation: Int!
// scroll property
private var firstX: CGFloat = 0.0
@ -181,9 +183,6 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
modalTransitionStyle = UIModalTransitionStyle.CrossDissolve
NSNotificationCenter.defaultCenter().addObserver(self, selector: "handleSKPhotoLoadingDidEndNotification:", name: SKPHOTO_LOADING_DID_END_NOTIFICATION, object: nil)
// it change delete button frame while rotation of device
NSNotificationCenter.defaultCenter().addObserver(self, selector: "changeOrientation", name: UIApplicationDidChangeStatusBarOrientationNotification, object: nil)
}
// MARK: - override
@ -247,7 +246,6 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
toolCounterButton = UIBarButtonItem(customView: toolCounterLabel)
// starting setting
setStartupValue()
setCustomSetting()
setSettingCloseButton()
setSettingDeleteButton()
@ -284,19 +282,20 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
isPerformingLayout = true
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
// resize frames of buttons after the device rotation
frameForButton()
// this algorithm resizes the current image after device rotation
if visiblePages.count > 0 {
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)
for page in visiblePages {
let pageIndex = page.tag - pageIndexTagOffset
page.frame = frameForPageAtIndex(pageIndex)
page.setMaxMinZoomScalesForCurrentBounds()
if page.captionView != nil {
page.captionView.frame = frameForCaptionView(page.captionView, index: pageIndex)
}
}
}
pagingScrollView.contentOffset = contentOffsetForPageAtIndex(currentPageIndex)
// where did start
didStartViewingPageAtIndex(currentPageIndex)
@ -326,15 +325,13 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
}
}
// MARK: - set startap values
private func setStartupValue() {
if customCloseButtonHideFrame != nil && customCloseButtonShowFrame != nil {
customCloseButtonHideOldFrame = customCloseButtonHideFrame
customCloseButtonShowOldFrame = customCloseButtonShowFrame
}
startOrientation = UIApplication.sharedApplication().statusBarOrientation.rawValue
public override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
recycledPages.removeAll()
}
// MARK: - set startap values
// MARK: - setting of buttons
// This function should be at the beginning of the other functions
private func setCustomSetting() {
@ -517,6 +514,7 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
// reset local cache
visiblePages.removeAll()
recycledPages.removeAll()
// set content offset
pagingScrollView.contentOffset = contentOffsetForPageAtIndex(currentPageIndex)
@ -537,7 +535,6 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
public func prepareForClosePhotoBrowser() {
applicationWindow.removeGestureRecognizer(panGesture)
NSObject.cancelPreviousPerformRequestsWithTarget(self)
delegate?.willDismissAtPageIndex?(currentPageIndex)
}
// MARK: - frame calculation
@ -596,6 +593,22 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
return CGSize(width: bounds.size.width * CGFloat(numberOfPhotos), height: bounds.size.height)
}
/// This function changes buttons's frame after the rotation of the device
private func frameForButton() {
if displayDeleteButton == true {
deleteButtonShowFrame = CGRect(x: view.frame.width - 44, y: 5, width: 44, height: 44)
deleteButtonHideFrame = CGRect(x: view.frame.width - 44, y: -20, width: 44, height: 44)
}
if displayCustomDeleteButton == true {
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)
}
if displayCustomCloseButton == true {
customCloseButtonHideFrame = CGRect(x: customCloseButtonHideFrame.origin.y, y: customCloseButtonHideFrame.origin.x, width: customCloseButtonHideFrame.width, height: customCloseButtonHideFrame.height)
customCloseButtonShowFrame = CGRect(x: customCloseButtonShowFrame.origin.y, y: customCloseButtonShowFrame.origin.x, width: customCloseButtonShowFrame.width, height: customCloseButtonShowFrame.height)
}
}
// MARK: - delete function
@objc private func deleteButtonPressed(sender: UIButton) {
delegate?.removePhoto?(self, index: currentPageIndex, reload: { () -> Void in
@ -657,28 +670,10 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
// gesture end
if sender.state == .Ended {
if scrollView.center.y > viewHalfHeight+40 || scrollView.center.y < viewHalfHeight-40 {
if currentPageIndex == initialPageIndex {
performCloseAnimationWithScrollView(scrollView)
return
}
let finalX: CGFloat = firstX
var finalY: CGFloat = 0.0
let windowHeight = applicationWindow.frame.size.height
if scrollView.center.y > viewHalfHeight+30 {
finalY = windowHeight * 2.0
} else {
finalY = -(viewHalfHeight)
}
UIView.beginAnimations(nil, context: nil)
UIView.setAnimationDuration(animationDuration)
UIView.setAnimationCurve(.EaseIn)
scrollView.center = CGPoint(x: finalX, y: finalY)
UIView.commitAnimations()
dismissPhotoBrowser()
determineAndClose()
return
} else {
// Continue Showing View
@ -711,7 +706,7 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
fadeView.alpha = 0.0
applicationWindow.addSubview(fadeView)
if let sender = senderViewForAnimation {
if let sender = delegate?.viewForPhoto?(self, index: initialPageIndex) ?? senderViewForAnimation {
senderViewOriginalFrame = (sender.superview?.convertRect(sender.frame, toView:nil))!
@ -802,6 +797,10 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
view.hidden = true
if let sender = senderViewForAnimation {
senderViewOriginalFrame = (sender.superview?.convertRect(sender.frame, toView:nil))!
}
let fadeView = UIView(frame: CGRect(x: 0, y: 0, width: screenWidth, height: screenHeight))
let contentOffset = scrollView.contentOffset
let scrollFrame = scrollView.photoImageView.frame
@ -848,10 +847,30 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
self.delegate?.didDismissAtPageIndex?(self.currentPageIndex)
}
}
private func determineAndClose() {
delegate?.willDismissAtPageIndex?(currentPageIndex)
let scrollView = pageDisplayedAtIndex(currentPageIndex)
if currentPageIndex == initialPageIndex {
performCloseAnimationWithScrollView(scrollView)
return
} else if let sender = delegate?.viewForPhoto?(self, index: currentPageIndex), image = photoAtIndex(currentPageIndex).underlyingImage {
senderViewForAnimation = sender
resizableImageView.image = image
performCloseAnimationWithScrollView(scrollView)
return
} else {
dismissPhotoBrowser()
}
}
//MARK: - image
private func getImageFromView(sender: UIView) -> UIImage {
UIGraphicsBeginImageContextWithOptions(sender.frame.size, true, 2.0)
UIGraphicsBeginImageContextWithOptions(sender.frame.size, true, 0.0)
sender.layer.renderInContext(UIGraphicsGetCurrentContext()!)
let result = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
@ -879,7 +898,7 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
if isViewLoaded() {
jumpToPageAtIndex(index)
if isViewActive {
if !isViewActive {
tilePages()
}
}
@ -929,6 +948,22 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
lastIndex = numberOfPhotos - 1
}
for page in visiblePages {
let newPageIndex = page.tag - pageIndexTagOffset
if newPageIndex < firstIndex || newPageIndex > lastIndex {
recycledPages.append(page)
page.prepareForReuse()
page.removeFromSuperview()
}
}
let visibleSet = Set(visiblePages)
visiblePages = Array(visibleSet.subtract(recycledPages))
while (recycledPages.count > 2) {
recycledPages.removeFirst()
}
for var index = firstIndex; index <= lastIndex; index++ {
if isDisplayingPageForIndex(index) {
continue
@ -939,10 +974,8 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
page.tag = index + pageIndexTagOffset
page.photo = photoAtIndex(index)
// visiblePages.insert(page)
visiblePages.append(page)
pagingScrollView.addSubview(page)
// if exists caption, insert
if let captionView = captionViewForPhotoAtIndex(index) {
captionView.frame = frameForCaptionView(captionView, index: index)
@ -1072,11 +1105,8 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
// MARK: - Button
public func closeButtonPressed(sender: UIButton) {
if currentPageIndex == initialPageIndex {
performCloseAnimationWithScrollView(pageDisplayedAtIndex(currentPageIndex))
} else {
dismissPhotoBrowser()
}
determineAndClose()
}
// MARK: Action Button
@ -1175,58 +1205,6 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
public func scrollViewDidEndScrollingAnimation(scrollView: UIScrollView) {
isEndAnimationByToolBar = true
}
// MARK: - device rotation
@objc private func changeOrientation() {
// setControlsHidden(true, animated: false, permanent: false)
// FIXME: - when we will to resolve this problem https://github.com/suzuki-0000/SKPhotoBrowser/issues/22 it will need to remove
deleteButtonShowFrame = CGRect(x: view.frame.width - 44, y: 5, width: 44, height: 44)
deleteButtonHideFrame = CGRect(x: view.frame.width - 44, y: -20, width: 44, height: 44)
// I didn't add customDeleteButton frame here
// customCloseButtonShowFrame = customCloseButtonShowOldFrame
// customCloseButtonHideFrame = customCloseButtonHideOldFrame
// if displayCustomCloseButton == true {
// if customCloseButtonShowFrame != nil && customCloseButtonHideFrame != nil {
// if customCloseButtonConstraints == nil {
// switch startOrientation {
// case 1, 2:
// changeCustomPortraitFrameAfterRotation()
// case 3, 4:
// changeCustomLandscapeFrameAfterRotation()
// default: break
// }
// }
// }
// }
// setControlsHidden(false, animated: false, permanent: false)
}
// FIXME: - Maybe it will be needed in the future
private func changeCustomPortraitFrameAfterRotation() {
if UIApplication.sharedApplication().statusBarOrientation.isLandscape {
customCloseButtonShowFrame = CGRect(x: customCloseButtonShowOldFrame.origin.x * 2, y: customCloseButtonShowOldFrame.origin.y / 2 + customCloseButtonShowOldFrame.height / 4, width: customCloseButtonShowOldFrame.width, height: customCloseButtonShowOldFrame.height)
customCloseButtonHideFrame = CGRect(x: customCloseButtonHideOldFrame.origin.x * 2, y: customCloseButtonHideOldFrame.origin.y / 2, width: customCloseButtonHideOldFrame.width, height: customCloseButtonHideOldFrame.height)
} else {
customCloseButtonShowFrame = CGRect(x: customCloseButtonShowOldFrame.origin.x, y: customCloseButtonShowOldFrame.origin.y, width: customCloseButtonShowOldFrame.width, height: customCloseButtonShowOldFrame.height)
customCloseButtonHideFrame = CGRect(x: customCloseButtonHideOldFrame.origin.x, y: customCloseButtonHideOldFrame.origin.y, width: customCloseButtonHideOldFrame.width, height: customCloseButtonHideOldFrame.height)
}
}
private func changeCustomLandscapeFrameAfterRotation() {
if UIApplication.sharedApplication().statusBarOrientation.isPortrait {
customCloseButtonShowFrame = CGRect(x: customCloseButtonShowOldFrame.origin.x / 2, y: customCloseButtonShowOldFrame.origin.y * 2 - customCloseButtonShowOldFrame.height / 2, width: customCloseButtonShowOldFrame.width, height: customCloseButtonShowOldFrame.height)
customCloseButtonHideFrame = CGRect(x: customCloseButtonHideOldFrame.origin.x / 2, y: customCloseButtonHideOldFrame.origin.y * 2 - customCloseButtonShowOldFrame.height / 2, width: customCloseButtonHideOldFrame.width, height: customCloseButtonHideOldFrame.height)
} else {
customCloseButtonShowFrame = CGRect(x: customCloseButtonShowOldFrame.origin.x, y: customCloseButtonShowOldFrame.origin.y, width: customCloseButtonShowOldFrame.width, height: customCloseButtonShowOldFrame.height)
customCloseButtonHideFrame = CGRect(x: customCloseButtonHideOldFrame.origin.x, y: customCloseButtonHideOldFrame.origin.y, width: customCloseButtonHideOldFrame.width, height: customCloseButtonHideOldFrame.height)
}
}
}
extension UIView

View File

@ -14,7 +14,9 @@ public class SKZoomingScrollView: UIScrollView, UIScrollViewDelegate, SKDetectin
var photo: SKPhotoProtocol! {
didSet {
photoImageView.image = nil
displayImage()
if photo != nil {
displayImage()
}
}
}
@ -146,6 +148,10 @@ public class SKZoomingScrollView: UIScrollView, UIScrollViewDelegate, SKDetectin
public func prepareForReuse() {
photo = nil
if captionView != nil {
captionView.removeFromSuperview()
captionView = nil
}
}
// MARK: - image

View File

@ -15,7 +15,6 @@
8909B5601BC792150060A053 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8909B55E1BC792150060A053 /* Main.storyboard */; };
8909B5621BC792150060A053 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8909B5611BC792150060A053 /* Assets.xcassets */; };
8909B5651BC792150060A053 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8909B5631BC792150060A053 /* LaunchScreen.storyboard */; };
8909B5731BC792AF0060A053 /* SKPhotoBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8909B5711BC792570060A053 /* SKPhotoBrowser.framework */; };
8909B5811BC792DC0060A053 /* image0.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 8909B5751BC792DC0060A053 /* image0.jpg */; };
8909B5821BC792DC0060A053 /* image1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 8909B5761BC792DC0060A053 /* image1.jpg */; };
8909B5831BC792DC0060A053 /* image10.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 8909B5771BC792DC0060A053 /* image10.jpg */; };
@ -28,6 +27,8 @@
8909B58A1BC792DC0060A053 /* image7.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 8909B57E1BC792DC0060A053 /* image7.jpg */; };
8909B58B1BC792DC0060A053 /* image8.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 8909B57F1BC792DC0060A053 /* image8.jpg */; };
8909B58C1BC792DC0060A053 /* image9.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 8909B5801BC792DC0060A053 /* image9.jpg */; };
A6A7B7801C9578E30025AC07 /* SKPhotoBrowser.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8909B5711BC792570060A053 /* SKPhotoBrowser.framework */; };
A6A7B7811C9578E30025AC07 /* SKPhotoBrowser.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 8909B5711BC792570060A053 /* SKPhotoBrowser.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -45,16 +46,23 @@
remoteGlobalIDString = 8909B5301BC791280060A053;
remoteInfo = SKPhotoBrowser;
};
A6A7B7821C9578E30025AC07 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 8909B56C1BC792570060A053 /* SKPhotoBrowser.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 8909B52F1BC791280060A053;
remoteInfo = SKPhotoBrowser;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
212705871C92BB2A00466223 /* Embed Frameworks */ = {
A6A7B7841C9578E30025AC07 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
212705841C92BB2A00466223 /* SKPhotoBrowser.framework in Embed Frameworks */,
A6A7B7811C9578E30025AC07 /* SKPhotoBrowser.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
@ -90,8 +98,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
212705831C92BB2A00466223 /* SKPhotoBrowser.framework in Frameworks */,
8909B5731BC792AF0060A053 /* SKPhotoBrowser.framework in Frameworks */,
A6A7B7801C9578E30025AC07 /* SKPhotoBrowser.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -167,12 +174,12 @@
8909B5531BC792150060A053 /* Sources */,
8909B5541BC792150060A053 /* Frameworks */,
8909B5551BC792150060A053 /* Resources */,
212705871C92BB2A00466223 /* Embed Frameworks */,
A6A7B7841C9578E30025AC07 /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
212705861C92BB2A00466223 /* PBXTargetDependency */,
A6A7B7831C9578E30025AC07 /* PBXTargetDependency */,
);
name = SKPhotoBrowserExample;
productName = SKPhotoBrowserExample;
@ -267,10 +274,10 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
212705861C92BB2A00466223 /* PBXTargetDependency */ = {
A6A7B7831C9578E30025AC07 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = SKPhotoBrowser;
targetProxy = 212705851C92BB2A00466223 /* PBXContainerItemProxy */;
targetProxy = A6A7B7821C9578E30025AC07 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
@ -381,7 +388,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
INFOPLIST_FILE = SKPhotoBrowserExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@ -394,7 +400,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
INFOPLIST_FILE = SKPhotoBrowserExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";

View File

@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIStatusBarHidden</key>
<false/>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
@ -32,11 +30,14 @@
<array>
<string>armv7</string>
</array>
<key>UIStatusBarHidden</key>
<false/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>

View File

@ -96,7 +96,8 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
}
func willDismissAtPageIndex(index: Int) {
// do some handle if you need
collectionView.visibleCells().forEach({$0.hidden = false})
collectionView.cellForItemAtIndexPath(NSIndexPath(forItem: index, inSection: 0))?.hidden = true
}
func willShowActionSheet(photoIndex: Int) {
@ -104,7 +105,7 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
}
func didDismissAtPageIndex(index: Int) {
// do some handle if you need
collectionView.cellForItemAtIndexPath(NSIndexPath(forItem: index, inSection: 0))?.hidden = false
}
func didDismissActionSheetWithButtonIndex(buttonIndex: Int, photoIndex: Int) {
@ -115,6 +116,10 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
// do some handle if you need
}
func viewForPhoto(browser: SKPhotoBrowser, index: Int) -> UIView? {
return collectionView.cellForItemAtIndexPath(NSIndexPath(forItem: index, inSection: 0))
}
}