From 0d1c06b263bba4144df01cd9ed94da221bbe136b Mon Sep 17 00:00:00 2001 From: Jose Manuel Silva Vela Date: Mon, 17 Nov 2014 08:21:43 -0500 Subject: [PATCH 1/2] Fix for gesture recognition and event notification Added new delegate to notify when the swipe event starts and when it ends. Added fix as well to solve issue of gesture being activated when the collection view is being swiped on the y axis. --- .gitignore | 2 + .../project.pbxproj | 550 ------------------ .../Base.lproj/Main.storyboard | 9 +- .../PodFiles/SECollectionViewFlowLayout.h | 10 + .../PodFiles/SECollectionViewFlowLayout.m | 40 +- 5 files changed, 55 insertions(+), 556 deletions(-) delete mode 100644 SECollectionViewFlowLayout.xcodeproj/project.pbxproj diff --git a/.gitignore b/.gitignore index c8764be..fff0913 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ xcuserdata/ project.xcworkspace/ xcshareddata/ *.swp + +SECollectionViewFlowLayout.xcodeproj/project.pbxproj diff --git a/SECollectionViewFlowLayout.xcodeproj/project.pbxproj b/SECollectionViewFlowLayout.xcodeproj/project.pbxproj deleted file mode 100644 index ddc2120..0000000 --- a/SECollectionViewFlowLayout.xcodeproj/project.pbxproj +++ /dev/null @@ -1,550 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - AF2471FB18B30BAD00614655 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF2471FA18B30BAD00614655 /* Foundation.framework */; }; - AF2471FD18B30BAD00614655 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF2471FC18B30BAD00614655 /* CoreGraphics.framework */; }; - AF2471FF18B30BAD00614655 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF2471FE18B30BAD00614655 /* UIKit.framework */; }; - AF24720518B30BAD00614655 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = AF24720318B30BAD00614655 /* InfoPlist.strings */; }; - AF24720718B30BAD00614655 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AF24720618B30BAD00614655 /* main.m */; }; - AF24720B18B30BAD00614655 /* SEAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AF24720A18B30BAD00614655 /* SEAppDelegate.m */; }; - AF24720E18B30BAD00614655 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AF24720C18B30BAD00614655 /* Main.storyboard */; }; - AF24721118B30BAD00614655 /* SEViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AF24721018B30BAD00614655 /* SEViewController.m */; }; - AF24721318B30BAD00614655 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AF24721218B30BAD00614655 /* Images.xcassets */; }; - AF24721A18B30BAD00614655 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF24721918B30BAD00614655 /* XCTest.framework */; }; - AF24721B18B30BAD00614655 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF2471FA18B30BAD00614655 /* Foundation.framework */; }; - AF24721C18B30BAD00614655 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF2471FE18B30BAD00614655 /* UIKit.framework */; }; - AF24722418B30BAD00614655 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = AF24722218B30BAD00614655 /* InfoPlist.strings */; }; - AF24722618B30BAD00614655 /* SECollectionViewFlowLayoutTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AF24722518B30BAD00614655 /* SECollectionViewFlowLayoutTests.m */; }; - AF24724B18B30D1A00614655 /* SECollectionViewFlowLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = AF24724A18B30D1A00614655 /* SECollectionViewFlowLayout.m */; }; - AF24725D18B32D8D00614655 /* QBImagePickerController.m in Sources */ = {isa = PBXBuildFile; fileRef = AF24724D18B32D8D00614655 /* QBImagePickerController.m */; }; - AF24725E18B32D8D00614655 /* QBAssetsCollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AF24724E18B32D8D00614655 /* QBAssetsCollectionViewController.m */; }; - AF24725F18B32D8D00614655 /* QBAssetsCollectionOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = AF24725018B32D8D00614655 /* QBAssetsCollectionOverlayView.m */; }; - AF24726018B32D8D00614655 /* QBAssetsCollectionCheckmarkView.m in Sources */ = {isa = PBXBuildFile; fileRef = AF24725118B32D8D00614655 /* QBAssetsCollectionCheckmarkView.m */; }; - AF24726118B32D8D00614655 /* QBAssetsCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = AF24725218B32D8D00614655 /* QBAssetsCollectionViewCell.m */; }; - AF24726218B32D8D00614655 /* QBAssetsCollectionFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = AF24725518B32D8D00614655 /* QBAssetsCollectionFooterView.m */; }; - AF24726318B32D8D00614655 /* QBImagePickerGroupCell.m in Sources */ = {isa = PBXBuildFile; fileRef = AF24725A18B32D8D00614655 /* QBImagePickerGroupCell.m */; }; - AF24726418B32D8D00614655 /* QBImagePickerThumbnailView.m in Sources */ = {isa = PBXBuildFile; fileRef = AF24725C18B32D8D00614655 /* QBImagePickerThumbnailView.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - AF24721D18B30BAD00614655 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = AF2471EF18B30BAD00614655 /* Project object */; - proxyType = 1; - remoteGlobalIDString = AF2471F618B30BAD00614655; - remoteInfo = SECollectionViewFlowLayout; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - AF2471F718B30BAD00614655 /* SECollectionViewFlowLayout.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SECollectionViewFlowLayout.app; sourceTree = BUILT_PRODUCTS_DIR; }; - AF2471FA18B30BAD00614655 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - AF2471FC18B30BAD00614655 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - AF2471FE18B30BAD00614655 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - AF24720218B30BAD00614655 /* SECollectionViewFlowLayout-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SECollectionViewFlowLayout-Info.plist"; sourceTree = ""; }; - AF24720418B30BAD00614655 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - AF24720618B30BAD00614655 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - AF24720818B30BAD00614655 /* SECollectionViewFlowLayout-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SECollectionViewFlowLayout-Prefix.pch"; sourceTree = ""; }; - AF24720918B30BAD00614655 /* SEAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SEAppDelegate.h; sourceTree = ""; }; - AF24720A18B30BAD00614655 /* SEAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SEAppDelegate.m; sourceTree = ""; }; - AF24720D18B30BAD00614655 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - AF24720F18B30BAD00614655 /* SEViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SEViewController.h; sourceTree = ""; }; - AF24721018B30BAD00614655 /* SEViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SEViewController.m; sourceTree = ""; }; - AF24721218B30BAD00614655 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - AF24721818B30BAD00614655 /* SECollectionViewFlowLayoutTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SECollectionViewFlowLayoutTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - AF24721918B30BAD00614655 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; - AF24722118B30BAD00614655 /* SECollectionViewFlowLayoutTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SECollectionViewFlowLayoutTests-Info.plist"; sourceTree = ""; }; - AF24722318B30BAD00614655 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - AF24722518B30BAD00614655 /* SECollectionViewFlowLayoutTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SECollectionViewFlowLayoutTests.m; sourceTree = ""; }; - AF24724918B30D1A00614655 /* SECollectionViewFlowLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SECollectionViewFlowLayout.h; path = PodFiles/SECollectionViewFlowLayout.h; sourceTree = ""; }; - AF24724A18B30D1A00614655 /* SECollectionViewFlowLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SECollectionViewFlowLayout.m; path = PodFiles/SECollectionViewFlowLayout.m; sourceTree = ""; }; - AF24724D18B32D8D00614655 /* QBImagePickerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QBImagePickerController.m; path = PodFiles/QBImagePickerController.m; sourceTree = ""; }; - AF24724E18B32D8D00614655 /* QBAssetsCollectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QBAssetsCollectionViewController.m; path = PodFiles/QBAssetsCollectionViewController.m; sourceTree = ""; }; - AF24724F18B32D8D00614655 /* QBAssetsCollectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QBAssetsCollectionViewController.h; path = PodFiles/QBAssetsCollectionViewController.h; sourceTree = ""; }; - AF24725018B32D8D00614655 /* QBAssetsCollectionOverlayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QBAssetsCollectionOverlayView.m; path = PodFiles/QBAssetsCollectionOverlayView.m; sourceTree = ""; }; - AF24725118B32D8D00614655 /* QBAssetsCollectionCheckmarkView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QBAssetsCollectionCheckmarkView.m; path = PodFiles/QBAssetsCollectionCheckmarkView.m; sourceTree = ""; }; - AF24725218B32D8D00614655 /* QBAssetsCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QBAssetsCollectionViewCell.m; path = PodFiles/QBAssetsCollectionViewCell.m; sourceTree = ""; }; - AF24725318B32D8D00614655 /* QBAssetsCollectionCheckmarkView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QBAssetsCollectionCheckmarkView.h; path = PodFiles/QBAssetsCollectionCheckmarkView.h; sourceTree = ""; }; - AF24725418B32D8D00614655 /* QBAssetsCollectionFooterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QBAssetsCollectionFooterView.h; path = PodFiles/QBAssetsCollectionFooterView.h; sourceTree = ""; }; - AF24725518B32D8D00614655 /* QBAssetsCollectionFooterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QBAssetsCollectionFooterView.m; path = PodFiles/QBAssetsCollectionFooterView.m; sourceTree = ""; }; - AF24725618B32D8D00614655 /* QBAssetsCollectionOverlayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QBAssetsCollectionOverlayView.h; path = PodFiles/QBAssetsCollectionOverlayView.h; sourceTree = ""; }; - AF24725718B32D8D00614655 /* QBAssetsCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QBAssetsCollectionViewCell.h; path = PodFiles/QBAssetsCollectionViewCell.h; sourceTree = ""; }; - AF24725818B32D8D00614655 /* QBImagePickerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QBImagePickerController.h; path = PodFiles/QBImagePickerController.h; sourceTree = ""; }; - AF24725918B32D8D00614655 /* QBImagePickerGroupCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QBImagePickerGroupCell.h; path = PodFiles/QBImagePickerGroupCell.h; sourceTree = ""; }; - AF24725A18B32D8D00614655 /* QBImagePickerGroupCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QBImagePickerGroupCell.m; path = PodFiles/QBImagePickerGroupCell.m; sourceTree = ""; }; - AF24725B18B32D8D00614655 /* QBImagePickerThumbnailView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QBImagePickerThumbnailView.h; path = PodFiles/QBImagePickerThumbnailView.h; sourceTree = ""; }; - AF24725C18B32D8D00614655 /* QBImagePickerThumbnailView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QBImagePickerThumbnailView.m; path = PodFiles/QBImagePickerThumbnailView.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - AF2471F418B30BAD00614655 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - AF2471FD18B30BAD00614655 /* CoreGraphics.framework in Frameworks */, - AF2471FF18B30BAD00614655 /* UIKit.framework in Frameworks */, - AF2471FB18B30BAD00614655 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - AF24721518B30BAD00614655 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - AF24721A18B30BAD00614655 /* XCTest.framework in Frameworks */, - AF24721C18B30BAD00614655 /* UIKit.framework in Frameworks */, - AF24721B18B30BAD00614655 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - AF2471EE18B30BAD00614655 = { - isa = PBXGroup; - children = ( - AF24720018B30BAD00614655 /* SECollectionViewFlowLayout */, - AF24721F18B30BAD00614655 /* SECollectionViewFlowLayoutTests */, - AF2471F918B30BAD00614655 /* Frameworks */, - AF2471F818B30BAD00614655 /* Products */, - ); - sourceTree = ""; - }; - AF2471F818B30BAD00614655 /* Products */ = { - isa = PBXGroup; - children = ( - AF2471F718B30BAD00614655 /* SECollectionViewFlowLayout.app */, - AF24721818B30BAD00614655 /* SECollectionViewFlowLayoutTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - AF2471F918B30BAD00614655 /* Frameworks */ = { - isa = PBXGroup; - children = ( - AF2471FA18B30BAD00614655 /* Foundation.framework */, - AF2471FC18B30BAD00614655 /* CoreGraphics.framework */, - AF2471FE18B30BAD00614655 /* UIKit.framework */, - AF24721918B30BAD00614655 /* XCTest.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - AF24720018B30BAD00614655 /* SECollectionViewFlowLayout */ = { - isa = PBXGroup; - children = ( - AF24724C18B32C8400614655 /* PodFiles */, - AF24720918B30BAD00614655 /* SEAppDelegate.h */, - AF24720A18B30BAD00614655 /* SEAppDelegate.m */, - AF24720C18B30BAD00614655 /* Main.storyboard */, - AF24720F18B30BAD00614655 /* SEViewController.h */, - AF24721018B30BAD00614655 /* SEViewController.m */, - AF24721218B30BAD00614655 /* Images.xcassets */, - AF24720118B30BAD00614655 /* Supporting Files */, - ); - path = SECollectionViewFlowLayout; - sourceTree = ""; - }; - AF24720118B30BAD00614655 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - AF24720218B30BAD00614655 /* SECollectionViewFlowLayout-Info.plist */, - AF24720318B30BAD00614655 /* InfoPlist.strings */, - AF24720618B30BAD00614655 /* main.m */, - AF24720818B30BAD00614655 /* SECollectionViewFlowLayout-Prefix.pch */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - AF24721F18B30BAD00614655 /* SECollectionViewFlowLayoutTests */ = { - isa = PBXGroup; - children = ( - AF24722518B30BAD00614655 /* SECollectionViewFlowLayoutTests.m */, - AF24722018B30BAD00614655 /* Supporting Files */, - ); - path = SECollectionViewFlowLayoutTests; - sourceTree = ""; - }; - AF24722018B30BAD00614655 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - AF24722118B30BAD00614655 /* SECollectionViewFlowLayoutTests-Info.plist */, - AF24722218B30BAD00614655 /* InfoPlist.strings */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - AF24722F18B30C2300614655 /* QBImagePickerController */ = { - isa = PBXGroup; - children = ( - AF24725818B32D8D00614655 /* QBImagePickerController.h */, - AF24724D18B32D8D00614655 /* QBImagePickerController.m */, - AF24724F18B32D8D00614655 /* QBAssetsCollectionViewController.h */, - AF24724E18B32D8D00614655 /* QBAssetsCollectionViewController.m */, - AF24725618B32D8D00614655 /* QBAssetsCollectionOverlayView.h */, - AF24725018B32D8D00614655 /* QBAssetsCollectionOverlayView.m */, - AF24725318B32D8D00614655 /* QBAssetsCollectionCheckmarkView.h */, - AF24725118B32D8D00614655 /* QBAssetsCollectionCheckmarkView.m */, - AF24725718B32D8D00614655 /* QBAssetsCollectionViewCell.h */, - AF24725218B32D8D00614655 /* QBAssetsCollectionViewCell.m */, - AF24725418B32D8D00614655 /* QBAssetsCollectionFooterView.h */, - AF24725518B32D8D00614655 /* QBAssetsCollectionFooterView.m */, - AF24725918B32D8D00614655 /* QBImagePickerGroupCell.h */, - AF24725A18B32D8D00614655 /* QBImagePickerGroupCell.m */, - AF24725B18B32D8D00614655 /* QBImagePickerThumbnailView.h */, - AF24725C18B32D8D00614655 /* QBImagePickerThumbnailView.m */, - ); - name = QBImagePickerController; - sourceTree = ""; - }; - AF24724C18B32C8400614655 /* PodFiles */ = { - isa = PBXGroup; - children = ( - AF24724918B30D1A00614655 /* SECollectionViewFlowLayout.h */, - AF24724A18B30D1A00614655 /* SECollectionViewFlowLayout.m */, - AF24722F18B30C2300614655 /* QBImagePickerController */, - ); - name = PodFiles; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - AF2471F618B30BAD00614655 /* SECollectionViewFlowLayout */ = { - isa = PBXNativeTarget; - buildConfigurationList = AF24722918B30BAD00614655 /* Build configuration list for PBXNativeTarget "SECollectionViewFlowLayout" */; - buildPhases = ( - AF2471F318B30BAD00614655 /* Sources */, - AF2471F418B30BAD00614655 /* Frameworks */, - AF2471F518B30BAD00614655 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SECollectionViewFlowLayout; - productName = SECollectionViewFlowLayout; - productReference = AF2471F718B30BAD00614655 /* SECollectionViewFlowLayout.app */; - productType = "com.apple.product-type.application"; - }; - AF24721718B30BAD00614655 /* SECollectionViewFlowLayoutTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = AF24722C18B30BAD00614655 /* Build configuration list for PBXNativeTarget "SECollectionViewFlowLayoutTests" */; - buildPhases = ( - AF24721418B30BAD00614655 /* Sources */, - AF24721518B30BAD00614655 /* Frameworks */, - AF24721618B30BAD00614655 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - AF24721E18B30BAD00614655 /* PBXTargetDependency */, - ); - name = SECollectionViewFlowLayoutTests; - productName = SECollectionViewFlowLayoutTests; - productReference = AF24721818B30BAD00614655 /* SECollectionViewFlowLayoutTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - AF2471EF18B30BAD00614655 /* Project object */ = { - isa = PBXProject; - attributes = { - CLASSPREFIX = SE; - LastUpgradeCheck = 0500; - ORGANIZATIONNAME = CEWendel; - TargetAttributes = { - AF24721718B30BAD00614655 = { - TestTargetID = AF2471F618B30BAD00614655; - }; - }; - }; - buildConfigurationList = AF2471F218B30BAD00614655 /* Build configuration list for PBXProject "SECollectionViewFlowLayout" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = AF2471EE18B30BAD00614655; - productRefGroup = AF2471F818B30BAD00614655 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - AF2471F618B30BAD00614655 /* SECollectionViewFlowLayout */, - AF24721718B30BAD00614655 /* SECollectionViewFlowLayoutTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - AF2471F518B30BAD00614655 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - AF24721318B30BAD00614655 /* Images.xcassets in Resources */, - AF24720518B30BAD00614655 /* InfoPlist.strings in Resources */, - AF24720E18B30BAD00614655 /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - AF24721618B30BAD00614655 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - AF24722418B30BAD00614655 /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - AF2471F318B30BAD00614655 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - AF24720B18B30BAD00614655 /* SEAppDelegate.m in Sources */, - AF24726118B32D8D00614655 /* QBAssetsCollectionViewCell.m in Sources */, - AF24721118B30BAD00614655 /* SEViewController.m in Sources */, - AF24726218B32D8D00614655 /* QBAssetsCollectionFooterView.m in Sources */, - AF24726018B32D8D00614655 /* QBAssetsCollectionCheckmarkView.m in Sources */, - AF24725E18B32D8D00614655 /* QBAssetsCollectionViewController.m in Sources */, - AF24725D18B32D8D00614655 /* QBImagePickerController.m in Sources */, - AF24720718B30BAD00614655 /* main.m in Sources */, - AF24724B18B30D1A00614655 /* SECollectionViewFlowLayout.m in Sources */, - AF24725F18B32D8D00614655 /* QBAssetsCollectionOverlayView.m in Sources */, - AF24726418B32D8D00614655 /* QBImagePickerThumbnailView.m in Sources */, - AF24726318B32D8D00614655 /* QBImagePickerGroupCell.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - AF24721418B30BAD00614655 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - AF24722618B30BAD00614655 /* SECollectionViewFlowLayoutTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - AF24721E18B30BAD00614655 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = AF2471F618B30BAD00614655 /* SECollectionViewFlowLayout */; - targetProxy = AF24721D18B30BAD00614655 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - AF24720318B30BAD00614655 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - AF24720418B30BAD00614655 /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; - AF24720C18B30BAD00614655 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - AF24720D18B30BAD00614655 /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - AF24722218B30BAD00614655 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - AF24722318B30BAD00614655 /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - AF24722718B30BAD00614655 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - AF24722818B30BAD00614655 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - AF24722A18B30BAD00614655 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "SECollectionViewFlowLayout/SECollectionViewFlowLayout-Prefix.pch"; - INFOPLIST_FILE = "SECollectionViewFlowLayout/SECollectionViewFlowLayout-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Debug; - }; - AF24722B18B30BAD00614655 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "SECollectionViewFlowLayout/SECollectionViewFlowLayout-Prefix.pch"; - INFOPLIST_FILE = "SECollectionViewFlowLayout/SECollectionViewFlowLayout-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Release; - }; - AF24722D18B30BAD00614655 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SECollectionViewFlowLayout.app/SECollectionViewFlowLayout"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "SECollectionViewFlowLayout/SECollectionViewFlowLayout-Prefix.pch"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = "SECollectionViewFlowLayoutTests/SECollectionViewFlowLayoutTests-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUNDLE_LOADER)"; - WRAPPER_EXTENSION = xctest; - }; - name = Debug; - }; - AF24722E18B30BAD00614655 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SECollectionViewFlowLayout.app/SECollectionViewFlowLayout"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "SECollectionViewFlowLayout/SECollectionViewFlowLayout-Prefix.pch"; - INFOPLIST_FILE = "SECollectionViewFlowLayoutTests/SECollectionViewFlowLayoutTests-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUNDLE_LOADER)"; - WRAPPER_EXTENSION = xctest; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - AF2471F218B30BAD00614655 /* Build configuration list for PBXProject "SECollectionViewFlowLayout" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - AF24722718B30BAD00614655 /* Debug */, - AF24722818B30BAD00614655 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - AF24722918B30BAD00614655 /* Build configuration list for PBXNativeTarget "SECollectionViewFlowLayout" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - AF24722A18B30BAD00614655 /* Debug */, - AF24722B18B30BAD00614655 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - AF24722C18B30BAD00614655 /* Build configuration list for PBXNativeTarget "SECollectionViewFlowLayoutTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - AF24722D18B30BAD00614655 /* Debug */, - AF24722E18B30BAD00614655 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = AF2471EF18B30BAD00614655 /* Project object */; -} diff --git a/SECollectionViewFlowLayout/Base.lproj/Main.storyboard b/SECollectionViewFlowLayout/Base.lproj/Main.storyboard index 5d0fada..089b4b3 100644 --- a/SECollectionViewFlowLayout/Base.lproj/Main.storyboard +++ b/SECollectionViewFlowLayout/Base.lproj/Main.storyboard @@ -1,10 +1,11 @@ - + - + + - + @@ -176,4 +177,4 @@ - \ No newline at end of file + diff --git a/SECollectionViewFlowLayout/PodFiles/SECollectionViewFlowLayout.h b/SECollectionViewFlowLayout/PodFiles/SECollectionViewFlowLayout.h index 5ceebd3..6b035b5 100644 --- a/SECollectionViewFlowLayout/PodFiles/SECollectionViewFlowLayout.h +++ b/SECollectionViewFlowLayout/PodFiles/SECollectionViewFlowLayout.h @@ -7,9 +7,19 @@ // #import +@class SECollectionViewFlowLayout; + +@protocol SECollectionViewFlowLayoutDelegate + +@optional +-(void)panGestureDidBeginInLayout:(SECollectionViewFlowLayout *)layout; +-(void)panGestureDidEndInLayout:(SECollectionViewFlowLayout *)layout; + +@end @interface SECollectionViewFlowLayout : UICollectionViewFlowLayout +@property (weak, nonatomic) id delegate; @property (nonatomic) BOOL panToDeselect; // If set to YES, enables the deselecting of cells by panning around on a touch down @property (nonatomic) BOOL autoSelectRows; // If set to YES, a pan across a row and then down a column will auto-select all cells in each row as you scroll down (used to easily select a lot of cells rather than panning over every cell) @property (nonatomic) BOOL autoSelectCellsBetweenTouches; // If set to YES, enables auto-selecting all cells between a first and second selected cell diff --git a/SECollectionViewFlowLayout/PodFiles/SECollectionViewFlowLayout.m b/SECollectionViewFlowLayout/PodFiles/SECollectionViewFlowLayout.m index b43628d..5967d1d 100644 --- a/SECollectionViewFlowLayout/PodFiles/SECollectionViewFlowLayout.m +++ b/SECollectionViewFlowLayout/PodFiles/SECollectionViewFlowLayout.m @@ -77,6 +77,21 @@ - (instancetype)init return self; } +-(instancetype)initWithCoder:(NSCoder *)aDecoder{ + self = [super initWithCoder:aDecoder]; + if(self){ + + _panToDeselect = NO; + _autoSelectRows = NO; + _autoSelectCellsBetweenTouches = NO; + + [self initializer]; + + } + return self; + +} + - (void)initializer { // Pan states @@ -105,6 +120,7 @@ - (void)setupCollectionView UIPanGestureRecognizer *panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanGesture:)]; panGestureRecognizer.delegate = self; [self.collectionView addGestureRecognizer:panGestureRecognizer]; + [self.collectionView.panGestureRecognizer requireGestureRecognizerToFail:panGestureRecognizer]; } #pragma mark - Gesture handling @@ -139,12 +155,22 @@ - (void)handleTapGesture:(UITapGestureRecognizer *)tapGestureRecognizer - (void)handlePanGesture:(UIPanGestureRecognizer *)panGestureRecognizer { // Get velocity and point of pan + + if(self.collectionView.allowsSelection == NO ){ + return; + } + CGPoint velocity = [panGestureRecognizer velocityInView:self.collectionView]; CGPoint point = [panGestureRecognizer locationInView:self.collectionView]; if (!self.collectionView.isDecelerating) { // Handle pan if (panGestureRecognizer.state == UIGestureRecognizerStateEnded) { + + if ((self.isSelecting || self.isDeselecting) && [self.delegate respondsToSelector:@selector(panGestureDidEndInLayout:)]) { + [self.delegate panGestureDidEndInLayout:self]; + } + // Reset pan states self.selecting = NO; self.selectedRow = NO; @@ -159,6 +185,11 @@ - (void)handlePanGesture:(UIPanGestureRecognizer *)panGestureRecognizer self.selecting = NO; }else { // Register as selecting the cells, not scrolling the collection view + if(panGestureRecognizer.state == UIGestureRecognizerStateBegan || self.isSelecting == NO){ + if ([self.delegate respondsToSelector:@selector(panGestureDidEndInLayout:)]) { + [self.delegate panGestureDidBeginInLayout:self]; + } + } self.selecting = YES; NSIndexPath *indexPath = [self.collectionView indexPathForItemAtPoint:point]; if (indexPath) { @@ -171,11 +202,11 @@ - (void)handlePanGesture:(UIPanGestureRecognizer *)panGestureRecognizer } else { if (!self.deselecting) { [self selectCellAtIndexPath:indexPath]; - + if (self.autoSelectRows) [self handleAutoSelectingRowsAtIndexPath:indexPath]; } } - + // Update previousIndexPath self.previousIndexPath = indexPath; } @@ -322,6 +353,11 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceive return YES; } +-(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{ + CGPoint velocity = [(UIPanGestureRecognizer *)gestureRecognizer velocityInView:self.collectionView]; + return fabs(velocity.x) > fabs(velocity.y); +} + - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { BOOL recognizeSimultaneously = !self.isSelecting; From da812b90481363ca525fc9dd36947f6ac8bc7398 Mon Sep 17 00:00:00 2001 From: Jose Manuel Silva Vela Date: Tue, 18 Nov 2014 08:52:28 -0500 Subject: [PATCH 2/2] Added call to collectionViewDelegate Added additional verification calls to collectionView in collectionView:shouldDeselectItemAtIndexPath and also collectionView:shouldSelectItemAtIndexPath --- .../PodFiles/SECollectionViewFlowLayout.m | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/SECollectionViewFlowLayout/PodFiles/SECollectionViewFlowLayout.m b/SECollectionViewFlowLayout/PodFiles/SECollectionViewFlowLayout.m index 5967d1d..4ebe160 100644 --- a/SECollectionViewFlowLayout/PodFiles/SECollectionViewFlowLayout.m +++ b/SECollectionViewFlowLayout/PodFiles/SECollectionViewFlowLayout.m @@ -135,9 +135,25 @@ - (void)handleTapGesture:(UITapGestureRecognizer *)tapGestureRecognizer if (indexPath) { UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:indexPath]; if (cell.isSelected) { + + if([self.collectionView.delegate respondsToSelector:@selector(collectionView:shouldDeselectItemAtIndexPath:)]){ + BOOL shouldDeselect = [self.collectionView.delegate collectionView:self.collectionView shouldDeselectItemAtIndexPath:indexPath]; + if(shouldDeselect == NO){ + return; + } + } + [self deselectCellAtIndexPath:indexPath]; } else { // Check if we should handle auto selecting the cells between two touches + + if([self.collectionView.delegate respondsToSelector:@selector(collectionView:shouldSelectItemAtIndexPath:)]){ + BOOL shouldSelect = [self.collectionView.delegate collectionView:self.collectionView shouldSelectItemAtIndexPath:indexPath]; + if(shouldSelect == NO){ + return; + } + } + if (self.autoSelectCellsBetweenTouches) { if (self.initialSelectedIndexPath) { [self selectAllItemsFromIndexPath:self.initialSelectedIndexPath toIndexPath:indexPath]; @@ -195,11 +211,27 @@ - (void)handlePanGesture:(UIPanGestureRecognizer *)panGestureRecognizer if (indexPath) { UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:indexPath]; if (cell.selected) { + + if([self.collectionView.delegate respondsToSelector:@selector(collectionView:shouldDeselectItemAtIndexPath:)]){ + BOOL shouldDeselect = [self.collectionView.delegate collectionView:self.collectionView shouldDeselectItemAtIndexPath:indexPath]; + if(shouldDeselect == NO){ + return; + } + } + if (self.panToDeselect) { if (!self.previousIndexPath && ![self.previousIndexPath isEqual:indexPath]) self.deselecting = YES; if (self.deselecting) [self deselectCellAtIndexPath:indexPath]; } } else { + + if([self.collectionView.delegate respondsToSelector:@selector(collectionView:shouldSelectItemAtIndexPath:)]){ + BOOL shouldSelect = [self.collectionView.delegate collectionView:self.collectionView shouldSelectItemAtIndexPath:indexPath]; + if(shouldSelect == NO){ + return; + } + } + if (!self.deselecting) { [self selectCellAtIndexPath:indexPath];