diff --git a/UPCarouselFlowLayout/UPCarouselFlowLayout.swift b/UPCarouselFlowLayout/UPCarouselFlowLayout.swift index a4a5da1..adad0b1 100644 --- a/UPCarouselFlowLayout/UPCarouselFlowLayout.swift +++ b/UPCarouselFlowLayout/UPCarouselFlowLayout.swift @@ -8,13 +8,11 @@ import UIKit - public enum UPCarouselFlowLayoutSpacingMode { case fixed(spacing: CGFloat) case overlap(visibleOffset: CGFloat) } - open class UPCarouselFlowLayout: UICollectionViewFlowLayout { fileprivate struct LayoutState { @@ -32,7 +30,6 @@ open class UPCarouselFlowLayout: UICollectionViewFlowLayout { fileprivate var state = LayoutState(size: CGSize.zero, direction: .horizontal) - override open func prepare() { super.prepare() let currentState = LayoutState(size: self.collectionView!.bounds.size, direction: self.scrollDirection) @@ -134,5 +131,8 @@ open class UPCarouselFlowLayout: UICollectionViewFlowLayout { return targetContentOffset } + + override open var flipsHorizontallyInOppositeLayoutDirection: Bool { + return true + } } - diff --git a/UPCarouselFlowLayoutDemo.xcodeproj/project.pbxproj b/UPCarouselFlowLayoutDemo.xcodeproj/project.pbxproj index e096e8d..73e5bb3 100644 --- a/UPCarouselFlowLayoutDemo.xcodeproj/project.pbxproj +++ b/UPCarouselFlowLayoutDemo.xcodeproj/project.pbxproj @@ -59,7 +59,6 @@ 01D387961D229BFC00CE4E1F /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 01D387A21D229E4A00CE4E1F /* UPCarouselFlowLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UPCarouselFlowLayout.swift; sourceTree = ""; }; 841C94F01DDEE4E300B997F5 /* UPCarouselFlowLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UPCarouselFlowLayout.h; sourceTree = ""; }; - 841C94F11DDEE4E300B997F5 /* UPCarouselFlowLayout.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UPCarouselFlowLayout.m; sourceTree = ""; }; 841C94FD1DDEE57F00B997F5 /* UPCarouselFlowLayout.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = UPCarouselFlowLayout.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 841C94FF1DDEE57F00B997F5 /* UPCarouselFlowLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UPCarouselFlowLayout.h; sourceTree = ""; }; 841C95001DDEE57F00B997F5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -106,7 +105,6 @@ 01D3878A1D229BFC00CE4E1F /* UPCarouselFlowLayoutDemo */ = { isa = PBXGroup; children = ( - 01D387A11D229E4A00CE4E1F /* UPCarouselFlowLayout */, 01D3878B1D229BFC00CE4E1F /* AppDelegate.swift */, 01D387931D229BFC00CE4E1F /* GradientView.swift */, 01D387961D229BFC00CE4E1F /* ViewController.swift */, @@ -120,19 +118,11 @@ path = UPCarouselFlowLayoutDemo; sourceTree = ""; }; - 01D387A11D229E4A00CE4E1F /* UPCarouselFlowLayout */ = { - isa = PBXGroup; - children = ( - 01D387A21D229E4A00CE4E1F /* UPCarouselFlowLayout.swift */, - ); - path = UPCarouselFlowLayout; - sourceTree = SOURCE_ROOT; - }; 841C94EF1DDEE4E300B997F5 /* UPCarouselFlowLayout */ = { isa = PBXGroup; children = ( 841C94F01DDEE4E300B997F5 /* UPCarouselFlowLayout.h */, - 841C94F11DDEE4E300B997F5 /* UPCarouselFlowLayout.m */, + 01D387A21D229E4A00CE4E1F /* UPCarouselFlowLayout.swift */, ); path = UPCarouselFlowLayout; sourceTree = "";