├── FZCarousel.png ├── FZCarousel.podspec ├── FZCarousel.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── FZCarousel.xccheckout └── xcuserdata │ └── noahblake.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── FZCarousel.xcscheme │ └── xcschememanagement.plist ├── FZCarousel ├── FZCarouselCollectionViewDelegate.h ├── FZCarouselCollectionViewDelegate.m ├── FZCarouselView.h └── FZCarouselView.m ├── FZCarouselDemo.gif ├── FZCarouselDemo ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Demo │ ├── FZDemoCarouselCollectionViewCell.h │ ├── FZDemoCarouselCollectionViewCell.m │ ├── FZDemoCarouselCollectionViewDelegate.h │ ├── FZDemoCarouselCollectionViewDelegate.m │ ├── FZDemoDefaultCarouselViewController.h │ ├── FZDemoDefaultCarouselViewController.m │ ├── FZDemoViewController.h │ └── FZDemoViewController.m ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── Supporting Files │ └── images │ │ ├── horse_01.png │ │ ├── horse_02.png │ │ ├── horse_03.png │ │ └── horse_04.png └── main.m ├── FZCarouselTests ├── FZCarouselTests.m └── Info.plist ├── LICENSE └── README.md /FZCarousel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-opensource/FZCarousel/9daa398099461a6368d582de7c06099f6c1a1e16/FZCarousel.png -------------------------------------------------------------------------------- /FZCarousel.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "FZCarousel" 3 | s.version = "0.1.2" 4 | s.summary = "FZCarouselCollectionViewDelegate provides a straightforward, lightweight interface for producing an \"infinitely\" scrolling carousel." 5 | s.homepage = "https://github.com/fuzz-productions/FZCarousel" 6 | s.license = 'MPL 2.0' 7 | s.author = { "Noah Blake" => "noah@fuzzproductions.com" } 8 | s.source = { :git => "https://github.com/fuzz-productions/FZCarousel.git", :tag => '0.1.2' } 9 | s.social_media_url = 'https://twitter.com/fuzzpro' 10 | 11 | s.platform = :ios, '7.0' 12 | s.requires_arc = true 13 | 14 | s.source_files = 'FZCarousel' 15 | s.resource_bundles = { 16 | 'FZCarousel' => ['Pod/Assets/*.png'] 17 | } 18 | s.frameworks = 'UIKit' 19 | end 20 | -------------------------------------------------------------------------------- /FZCarousel.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1D19DC5E1A5CA0BF00C299E2 /* FZCarouselTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D19DC5D1A5CA0BF00C299E2 /* FZCarouselTests.m */; }; 11 | 1D39BBE81A604186003FDCAC /* FZCarouselCollectionViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D39BBE71A604186003FDCAC /* FZCarouselCollectionViewDelegate.m */; }; 12 | 1D39BBEF1A604195003FDCAC /* FZDemoCarouselCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D39BBEA1A604195003FDCAC /* FZDemoCarouselCollectionViewCell.m */; }; 13 | 1D39BBF01A604195003FDCAC /* FZDemoCarouselCollectionViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D39BBEC1A604195003FDCAC /* FZDemoCarouselCollectionViewDelegate.m */; }; 14 | 1D39BBF11A604195003FDCAC /* FZDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D39BBEE1A604195003FDCAC /* FZDemoViewController.m */; }; 15 | 1D39BBF41A6041A9003FDCAC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D39BBF31A6041A9003FDCAC /* AppDelegate.m */; }; 16 | 1D39BBF71A6041E6003FDCAC /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1D39BBF51A6041E6003FDCAC /* Info.plist */; }; 17 | 1D39BBF81A6041E6003FDCAC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D39BBF61A6041E6003FDCAC /* main.m */; }; 18 | 1D39BBFE1A6041EF003FDCAC /* horse_01.png in Resources */ = {isa = PBXBuildFile; fileRef = 1D39BBFA1A6041EF003FDCAC /* horse_01.png */; }; 19 | 1D39BBFF1A6041EF003FDCAC /* horse_02.png in Resources */ = {isa = PBXBuildFile; fileRef = 1D39BBFB1A6041EF003FDCAC /* horse_02.png */; }; 20 | 1D39BC001A6041EF003FDCAC /* horse_03.png in Resources */ = {isa = PBXBuildFile; fileRef = 1D39BBFC1A6041EF003FDCAC /* horse_03.png */; }; 21 | 1D39BC011A6041EF003FDCAC /* horse_04.png in Resources */ = {isa = PBXBuildFile; fileRef = 1D39BBFD1A6041EF003FDCAC /* horse_04.png */; }; 22 | 1D39BC061A60420D003FDCAC /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1D39BC021A60420D003FDCAC /* LaunchScreen.xib */; }; 23 | 1D39BC071A60420D003FDCAC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1D39BC041A60420D003FDCAC /* Main.storyboard */; }; 24 | 1D39BC091A604215003FDCAC /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1D39BC081A604215003FDCAC /* Images.xcassets */; }; 25 | EF6E27E81BB5BE2500F455BE /* FZCarouselView.m in Sources */ = {isa = PBXBuildFile; fileRef = EF6E27E71BB5BE2500F455BE /* FZCarouselView.m */; settings = {ASSET_TAGS = (); }; }; 26 | EF6E27EB1BB5C8A900F455BE /* FZDemoDefaultCarouselViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EF6E27EA1BB5C8A900F455BE /* FZDemoDefaultCarouselViewController.m */; settings = {ASSET_TAGS = (); }; }; 27 | /* End PBXBuildFile section */ 28 | 29 | /* Begin PBXContainerItemProxy section */ 30 | 1D19DC581A5CA0BF00C299E2 /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 1D19DC361A5CA0BF00C299E2 /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 1D19DC3D1A5CA0BF00C299E2; 35 | remoteInfo = FZCarousel; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 1D19DC3E1A5CA0BF00C299E2 /* FZCarousel.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FZCarousel.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 1D19DC571A5CA0BF00C299E2 /* FZCarouselTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FZCarouselTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 1D19DC5C1A5CA0BF00C299E2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | 1D19DC5D1A5CA0BF00C299E2 /* FZCarouselTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FZCarouselTests.m; sourceTree = ""; }; 44 | 1D39BBE61A604186003FDCAC /* FZCarouselCollectionViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FZCarouselCollectionViewDelegate.h; path = FZCarousel/FZCarouselCollectionViewDelegate.h; sourceTree = SOURCE_ROOT; }; 45 | 1D39BBE71A604186003FDCAC /* FZCarouselCollectionViewDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FZCarouselCollectionViewDelegate.m; path = FZCarousel/FZCarouselCollectionViewDelegate.m; sourceTree = SOURCE_ROOT; }; 46 | 1D39BBE91A604195003FDCAC /* FZDemoCarouselCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FZDemoCarouselCollectionViewCell.h; path = FZCarouselDemo/Demo/FZDemoCarouselCollectionViewCell.h; sourceTree = SOURCE_ROOT; }; 47 | 1D39BBEA1A604195003FDCAC /* FZDemoCarouselCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FZDemoCarouselCollectionViewCell.m; path = FZCarouselDemo/Demo/FZDemoCarouselCollectionViewCell.m; sourceTree = SOURCE_ROOT; }; 48 | 1D39BBEB1A604195003FDCAC /* FZDemoCarouselCollectionViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FZDemoCarouselCollectionViewDelegate.h; path = FZCarouselDemo/Demo/FZDemoCarouselCollectionViewDelegate.h; sourceTree = SOURCE_ROOT; }; 49 | 1D39BBEC1A604195003FDCAC /* FZDemoCarouselCollectionViewDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FZDemoCarouselCollectionViewDelegate.m; path = FZCarouselDemo/Demo/FZDemoCarouselCollectionViewDelegate.m; sourceTree = SOURCE_ROOT; }; 50 | 1D39BBED1A604195003FDCAC /* FZDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FZDemoViewController.h; path = FZCarouselDemo/Demo/FZDemoViewController.h; sourceTree = SOURCE_ROOT; }; 51 | 1D39BBEE1A604195003FDCAC /* FZDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FZDemoViewController.m; path = FZCarouselDemo/Demo/FZDemoViewController.m; sourceTree = SOURCE_ROOT; }; 52 | 1D39BBF21A6041A9003FDCAC /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = FZCarouselDemo/AppDelegate.h; sourceTree = SOURCE_ROOT; }; 53 | 1D39BBF31A6041A9003FDCAC /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = FZCarouselDemo/AppDelegate.m; sourceTree = SOURCE_ROOT; }; 54 | 1D39BBF51A6041E6003FDCAC /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = FZCarouselDemo/Info.plist; sourceTree = SOURCE_ROOT; }; 55 | 1D39BBF61A6041E6003FDCAC /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = FZCarouselDemo/main.m; sourceTree = SOURCE_ROOT; }; 56 | 1D39BBFA1A6041EF003FDCAC /* horse_01.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = horse_01.png; sourceTree = ""; }; 57 | 1D39BBFB1A6041EF003FDCAC /* horse_02.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = horse_02.png; sourceTree = ""; }; 58 | 1D39BBFC1A6041EF003FDCAC /* horse_03.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = horse_03.png; sourceTree = ""; }; 59 | 1D39BBFD1A6041EF003FDCAC /* horse_04.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = horse_04.png; sourceTree = ""; }; 60 | 1D39BC031A60420D003FDCAC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = FZCarouselDemo/Base.lproj/LaunchScreen.xib; sourceTree = SOURCE_ROOT; }; 61 | 1D39BC051A60420D003FDCAC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = FZCarouselDemo/Base.lproj/Main.storyboard; sourceTree = SOURCE_ROOT; }; 62 | 1D39BC081A604215003FDCAC /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = FZCarouselDemo/Images.xcassets; sourceTree = SOURCE_ROOT; }; 63 | EF6E27E61BB5BE2500F455BE /* FZCarouselView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FZCarouselView.h; path = FZCarousel/FZCarouselView.h; sourceTree = SOURCE_ROOT; }; 64 | EF6E27E71BB5BE2500F455BE /* FZCarouselView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FZCarouselView.m; path = FZCarousel/FZCarouselView.m; sourceTree = SOURCE_ROOT; }; 65 | EF6E27E91BB5C8A900F455BE /* FZDemoDefaultCarouselViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FZDemoDefaultCarouselViewController.h; path = FZCarouselDemo/Demo/FZDemoDefaultCarouselViewController.h; sourceTree = SOURCE_ROOT; }; 66 | EF6E27EA1BB5C8A900F455BE /* FZDemoDefaultCarouselViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FZDemoDefaultCarouselViewController.m; path = FZCarouselDemo/Demo/FZDemoDefaultCarouselViewController.m; sourceTree = SOURCE_ROOT; }; 67 | /* End PBXFileReference section */ 68 | 69 | /* Begin PBXFrameworksBuildPhase section */ 70 | 1D19DC3B1A5CA0BF00C299E2 /* Frameworks */ = { 71 | isa = PBXFrameworksBuildPhase; 72 | buildActionMask = 2147483647; 73 | files = ( 74 | ); 75 | runOnlyForDeploymentPostprocessing = 0; 76 | }; 77 | 1D19DC541A5CA0BF00C299E2 /* Frameworks */ = { 78 | isa = PBXFrameworksBuildPhase; 79 | buildActionMask = 2147483647; 80 | files = ( 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | /* End PBXFrameworksBuildPhase section */ 85 | 86 | /* Begin PBXGroup section */ 87 | 1D19DC351A5CA0BF00C299E2 = { 88 | isa = PBXGroup; 89 | children = ( 90 | 1D19DC401A5CA0BF00C299E2 /* FZCarouselDemo */, 91 | 1D19DC5A1A5CA0BF00C299E2 /* FZCarouselTests */, 92 | 1D19DC3F1A5CA0BF00C299E2 /* Products */, 93 | ); 94 | sourceTree = ""; 95 | }; 96 | 1D19DC3F1A5CA0BF00C299E2 /* Products */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 1D19DC3E1A5CA0BF00C299E2 /* FZCarousel.app */, 100 | 1D19DC571A5CA0BF00C299E2 /* FZCarouselTests.xctest */, 101 | ); 102 | name = Products; 103 | sourceTree = ""; 104 | }; 105 | 1D19DC401A5CA0BF00C299E2 /* FZCarouselDemo */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 1D19DC721A5CA24000C299E2 /* Demo */, 109 | 1D19DC791A5CA24700C299E2 /* FZCarousel */, 110 | 1D39BBF21A6041A9003FDCAC /* AppDelegate.h */, 111 | 1D39BBF31A6041A9003FDCAC /* AppDelegate.m */, 112 | 1D39BC021A60420D003FDCAC /* LaunchScreen.xib */, 113 | 1D39BC041A60420D003FDCAC /* Main.storyboard */, 114 | 1D39BC081A604215003FDCAC /* Images.xcassets */, 115 | 1D19DC411A5CA0BF00C299E2 /* Supporting Files */, 116 | ); 117 | name = FZCarouselDemo; 118 | path = FZCarousel; 119 | sourceTree = ""; 120 | }; 121 | 1D19DC411A5CA0BF00C299E2 /* Supporting Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 1D39BBF51A6041E6003FDCAC /* Info.plist */, 125 | 1D39BBF61A6041E6003FDCAC /* main.m */, 126 | 1D39BBF91A6041EF003FDCAC /* images */, 127 | ); 128 | name = "Supporting Files"; 129 | sourceTree = ""; 130 | }; 131 | 1D19DC5A1A5CA0BF00C299E2 /* FZCarouselTests */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 1D19DC5D1A5CA0BF00C299E2 /* FZCarouselTests.m */, 135 | 1D19DC5B1A5CA0BF00C299E2 /* Supporting Files */, 136 | ); 137 | path = FZCarouselTests; 138 | sourceTree = ""; 139 | }; 140 | 1D19DC5B1A5CA0BF00C299E2 /* Supporting Files */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | 1D19DC5C1A5CA0BF00C299E2 /* Info.plist */, 144 | ); 145 | name = "Supporting Files"; 146 | sourceTree = ""; 147 | }; 148 | 1D19DC721A5CA24000C299E2 /* Demo */ = { 149 | isa = PBXGroup; 150 | children = ( 151 | 1D39BBE91A604195003FDCAC /* FZDemoCarouselCollectionViewCell.h */, 152 | 1D39BBEA1A604195003FDCAC /* FZDemoCarouselCollectionViewCell.m */, 153 | 1D39BBEB1A604195003FDCAC /* FZDemoCarouselCollectionViewDelegate.h */, 154 | 1D39BBEC1A604195003FDCAC /* FZDemoCarouselCollectionViewDelegate.m */, 155 | 1D39BBED1A604195003FDCAC /* FZDemoViewController.h */, 156 | 1D39BBEE1A604195003FDCAC /* FZDemoViewController.m */, 157 | EF6E27E91BB5C8A900F455BE /* FZDemoDefaultCarouselViewController.h */, 158 | EF6E27EA1BB5C8A900F455BE /* FZDemoDefaultCarouselViewController.m */, 159 | ); 160 | path = Demo; 161 | sourceTree = ""; 162 | }; 163 | 1D19DC791A5CA24700C299E2 /* FZCarousel */ = { 164 | isa = PBXGroup; 165 | children = ( 166 | 1D39BBE61A604186003FDCAC /* FZCarouselCollectionViewDelegate.h */, 167 | 1D39BBE71A604186003FDCAC /* FZCarouselCollectionViewDelegate.m */, 168 | EF6E27E61BB5BE2500F455BE /* FZCarouselView.h */, 169 | EF6E27E71BB5BE2500F455BE /* FZCarouselView.m */, 170 | ); 171 | name = FZCarousel; 172 | path = Source; 173 | sourceTree = ""; 174 | }; 175 | 1D39BBF91A6041EF003FDCAC /* images */ = { 176 | isa = PBXGroup; 177 | children = ( 178 | 1D39BBFA1A6041EF003FDCAC /* horse_01.png */, 179 | 1D39BBFB1A6041EF003FDCAC /* horse_02.png */, 180 | 1D39BBFC1A6041EF003FDCAC /* horse_03.png */, 181 | 1D39BBFD1A6041EF003FDCAC /* horse_04.png */, 182 | ); 183 | name = images; 184 | path = "FZCarouselDemo/Supporting Files/images"; 185 | sourceTree = SOURCE_ROOT; 186 | }; 187 | /* End PBXGroup section */ 188 | 189 | /* Begin PBXNativeTarget section */ 190 | 1D19DC3D1A5CA0BF00C299E2 /* FZCarousel */ = { 191 | isa = PBXNativeTarget; 192 | buildConfigurationList = 1D19DC611A5CA0BF00C299E2 /* Build configuration list for PBXNativeTarget "FZCarousel" */; 193 | buildPhases = ( 194 | 1D19DC3A1A5CA0BF00C299E2 /* Sources */, 195 | 1D19DC3B1A5CA0BF00C299E2 /* Frameworks */, 196 | 1D19DC3C1A5CA0BF00C299E2 /* Resources */, 197 | ); 198 | buildRules = ( 199 | ); 200 | dependencies = ( 201 | ); 202 | name = FZCarousel; 203 | productName = FZCarousel; 204 | productReference = 1D19DC3E1A5CA0BF00C299E2 /* FZCarousel.app */; 205 | productType = "com.apple.product-type.application"; 206 | }; 207 | 1D19DC561A5CA0BF00C299E2 /* FZCarouselTests */ = { 208 | isa = PBXNativeTarget; 209 | buildConfigurationList = 1D19DC641A5CA0BF00C299E2 /* Build configuration list for PBXNativeTarget "FZCarouselTests" */; 210 | buildPhases = ( 211 | 1D19DC531A5CA0BF00C299E2 /* Sources */, 212 | 1D19DC541A5CA0BF00C299E2 /* Frameworks */, 213 | 1D19DC551A5CA0BF00C299E2 /* Resources */, 214 | ); 215 | buildRules = ( 216 | ); 217 | dependencies = ( 218 | 1D19DC591A5CA0BF00C299E2 /* PBXTargetDependency */, 219 | ); 220 | name = FZCarouselTests; 221 | productName = FZCarouselTests; 222 | productReference = 1D19DC571A5CA0BF00C299E2 /* FZCarouselTests.xctest */; 223 | productType = "com.apple.product-type.bundle.unit-test"; 224 | }; 225 | /* End PBXNativeTarget section */ 226 | 227 | /* Begin PBXProject section */ 228 | 1D19DC361A5CA0BF00C299E2 /* Project object */ = { 229 | isa = PBXProject; 230 | attributes = { 231 | LastUpgradeCheck = 0610; 232 | ORGANIZATIONNAME = "Fuzz Productions, LLC."; 233 | TargetAttributes = { 234 | 1D19DC3D1A5CA0BF00C299E2 = { 235 | CreatedOnToolsVersion = 6.1.1; 236 | }; 237 | 1D19DC561A5CA0BF00C299E2 = { 238 | CreatedOnToolsVersion = 6.1.1; 239 | TestTargetID = 1D19DC3D1A5CA0BF00C299E2; 240 | }; 241 | }; 242 | }; 243 | buildConfigurationList = 1D19DC391A5CA0BF00C299E2 /* Build configuration list for PBXProject "FZCarousel" */; 244 | compatibilityVersion = "Xcode 3.2"; 245 | developmentRegion = English; 246 | hasScannedForEncodings = 0; 247 | knownRegions = ( 248 | en, 249 | Base, 250 | ); 251 | mainGroup = 1D19DC351A5CA0BF00C299E2; 252 | productRefGroup = 1D19DC3F1A5CA0BF00C299E2 /* Products */; 253 | projectDirPath = ""; 254 | projectRoot = ""; 255 | targets = ( 256 | 1D19DC3D1A5CA0BF00C299E2 /* FZCarousel */, 257 | 1D19DC561A5CA0BF00C299E2 /* FZCarouselTests */, 258 | ); 259 | }; 260 | /* End PBXProject section */ 261 | 262 | /* Begin PBXResourcesBuildPhase section */ 263 | 1D19DC3C1A5CA0BF00C299E2 /* Resources */ = { 264 | isa = PBXResourcesBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | 1D39BC071A60420D003FDCAC /* Main.storyboard in Resources */, 268 | 1D39BC091A604215003FDCAC /* Images.xcassets in Resources */, 269 | 1D39BC001A6041EF003FDCAC /* horse_03.png in Resources */, 270 | 1D39BBF71A6041E6003FDCAC /* Info.plist in Resources */, 271 | 1D39BC011A6041EF003FDCAC /* horse_04.png in Resources */, 272 | 1D39BBFE1A6041EF003FDCAC /* horse_01.png in Resources */, 273 | 1D39BC061A60420D003FDCAC /* LaunchScreen.xib in Resources */, 274 | 1D39BBFF1A6041EF003FDCAC /* horse_02.png in Resources */, 275 | ); 276 | runOnlyForDeploymentPostprocessing = 0; 277 | }; 278 | 1D19DC551A5CA0BF00C299E2 /* Resources */ = { 279 | isa = PBXResourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | ); 283 | runOnlyForDeploymentPostprocessing = 0; 284 | }; 285 | /* End PBXResourcesBuildPhase section */ 286 | 287 | /* Begin PBXSourcesBuildPhase section */ 288 | 1D19DC3A1A5CA0BF00C299E2 /* Sources */ = { 289 | isa = PBXSourcesBuildPhase; 290 | buildActionMask = 2147483647; 291 | files = ( 292 | 1D39BBF11A604195003FDCAC /* FZDemoViewController.m in Sources */, 293 | 1D39BBE81A604186003FDCAC /* FZCarouselCollectionViewDelegate.m in Sources */, 294 | 1D39BBEF1A604195003FDCAC /* FZDemoCarouselCollectionViewCell.m in Sources */, 295 | 1D39BBF01A604195003FDCAC /* FZDemoCarouselCollectionViewDelegate.m in Sources */, 296 | 1D39BBF81A6041E6003FDCAC /* main.m in Sources */, 297 | 1D39BBF41A6041A9003FDCAC /* AppDelegate.m in Sources */, 298 | EF6E27E81BB5BE2500F455BE /* FZCarouselView.m in Sources */, 299 | EF6E27EB1BB5C8A900F455BE /* FZDemoDefaultCarouselViewController.m in Sources */, 300 | ); 301 | runOnlyForDeploymentPostprocessing = 0; 302 | }; 303 | 1D19DC531A5CA0BF00C299E2 /* Sources */ = { 304 | isa = PBXSourcesBuildPhase; 305 | buildActionMask = 2147483647; 306 | files = ( 307 | 1D19DC5E1A5CA0BF00C299E2 /* FZCarouselTests.m in Sources */, 308 | ); 309 | runOnlyForDeploymentPostprocessing = 0; 310 | }; 311 | /* End PBXSourcesBuildPhase section */ 312 | 313 | /* Begin PBXTargetDependency section */ 314 | 1D19DC591A5CA0BF00C299E2 /* PBXTargetDependency */ = { 315 | isa = PBXTargetDependency; 316 | target = 1D19DC3D1A5CA0BF00C299E2 /* FZCarousel */; 317 | targetProxy = 1D19DC581A5CA0BF00C299E2 /* PBXContainerItemProxy */; 318 | }; 319 | /* End PBXTargetDependency section */ 320 | 321 | /* Begin PBXVariantGroup section */ 322 | 1D39BC021A60420D003FDCAC /* LaunchScreen.xib */ = { 323 | isa = PBXVariantGroup; 324 | children = ( 325 | 1D39BC031A60420D003FDCAC /* Base */, 326 | ); 327 | name = LaunchScreen.xib; 328 | sourceTree = ""; 329 | }; 330 | 1D39BC041A60420D003FDCAC /* Main.storyboard */ = { 331 | isa = PBXVariantGroup; 332 | children = ( 333 | 1D39BC051A60420D003FDCAC /* Base */, 334 | ); 335 | name = Main.storyboard; 336 | sourceTree = ""; 337 | }; 338 | /* End PBXVariantGroup section */ 339 | 340 | /* Begin XCBuildConfiguration section */ 341 | 1D19DC5F1A5CA0BF00C299E2 /* Debug */ = { 342 | isa = XCBuildConfiguration; 343 | buildSettings = { 344 | ALWAYS_SEARCH_USER_PATHS = NO; 345 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 346 | CLANG_CXX_LIBRARY = "libc++"; 347 | CLANG_ENABLE_MODULES = YES; 348 | CLANG_ENABLE_OBJC_ARC = YES; 349 | CLANG_WARN_BOOL_CONVERSION = YES; 350 | CLANG_WARN_CONSTANT_CONVERSION = YES; 351 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 352 | CLANG_WARN_EMPTY_BODY = YES; 353 | CLANG_WARN_ENUM_CONVERSION = YES; 354 | CLANG_WARN_INT_CONVERSION = YES; 355 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 356 | CLANG_WARN_UNREACHABLE_CODE = YES; 357 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 358 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 359 | COPY_PHASE_STRIP = NO; 360 | ENABLE_STRICT_OBJC_MSGSEND = YES; 361 | GCC_C_LANGUAGE_STANDARD = gnu99; 362 | GCC_DYNAMIC_NO_PIC = NO; 363 | GCC_OPTIMIZATION_LEVEL = 0; 364 | GCC_PREPROCESSOR_DEFINITIONS = ( 365 | "DEBUG=1", 366 | "$(inherited)", 367 | ); 368 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 369 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 370 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 371 | GCC_WARN_UNDECLARED_SELECTOR = YES; 372 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 373 | GCC_WARN_UNUSED_FUNCTION = YES; 374 | GCC_WARN_UNUSED_VARIABLE = YES; 375 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 376 | MTL_ENABLE_DEBUG_INFO = YES; 377 | ONLY_ACTIVE_ARCH = YES; 378 | SDKROOT = iphoneos; 379 | }; 380 | name = Debug; 381 | }; 382 | 1D19DC601A5CA0BF00C299E2 /* Release */ = { 383 | isa = XCBuildConfiguration; 384 | buildSettings = { 385 | ALWAYS_SEARCH_USER_PATHS = NO; 386 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 387 | CLANG_CXX_LIBRARY = "libc++"; 388 | CLANG_ENABLE_MODULES = YES; 389 | CLANG_ENABLE_OBJC_ARC = YES; 390 | CLANG_WARN_BOOL_CONVERSION = YES; 391 | CLANG_WARN_CONSTANT_CONVERSION = YES; 392 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 393 | CLANG_WARN_EMPTY_BODY = YES; 394 | CLANG_WARN_ENUM_CONVERSION = YES; 395 | CLANG_WARN_INT_CONVERSION = YES; 396 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 397 | CLANG_WARN_UNREACHABLE_CODE = YES; 398 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 399 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 400 | COPY_PHASE_STRIP = YES; 401 | ENABLE_NS_ASSERTIONS = NO; 402 | ENABLE_STRICT_OBJC_MSGSEND = YES; 403 | GCC_C_LANGUAGE_STANDARD = gnu99; 404 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 405 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 406 | GCC_WARN_UNDECLARED_SELECTOR = YES; 407 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 408 | GCC_WARN_UNUSED_FUNCTION = YES; 409 | GCC_WARN_UNUSED_VARIABLE = YES; 410 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 411 | MTL_ENABLE_DEBUG_INFO = NO; 412 | SDKROOT = iphoneos; 413 | VALIDATE_PRODUCT = YES; 414 | }; 415 | name = Release; 416 | }; 417 | 1D19DC621A5CA0BF00C299E2 /* Debug */ = { 418 | isa = XCBuildConfiguration; 419 | buildSettings = { 420 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 421 | INFOPLIST_FILE = "$(SRCROOT)/FZCarouselDemo/Info.plist"; 422 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 423 | PRODUCT_NAME = "$(TARGET_NAME)"; 424 | }; 425 | name = Debug; 426 | }; 427 | 1D19DC631A5CA0BF00C299E2 /* Release */ = { 428 | isa = XCBuildConfiguration; 429 | buildSettings = { 430 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 431 | INFOPLIST_FILE = "$(SRCROOT)/FZCarouselDemo/Info.plist"; 432 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 433 | PRODUCT_NAME = "$(TARGET_NAME)"; 434 | }; 435 | name = Release; 436 | }; 437 | 1D19DC651A5CA0BF00C299E2 /* Debug */ = { 438 | isa = XCBuildConfiguration; 439 | buildSettings = { 440 | BUNDLE_LOADER = "$(TEST_HOST)"; 441 | FRAMEWORK_SEARCH_PATHS = ( 442 | "$(SDKROOT)/Developer/Library/Frameworks", 443 | "$(inherited)", 444 | ); 445 | GCC_PREPROCESSOR_DEFINITIONS = ( 446 | "DEBUG=1", 447 | "$(inherited)", 448 | ); 449 | INFOPLIST_FILE = FZCarouselTests/Info.plist; 450 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 451 | PRODUCT_NAME = "$(TARGET_NAME)"; 452 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FZCarousel.app/FZCarousel"; 453 | }; 454 | name = Debug; 455 | }; 456 | 1D19DC661A5CA0BF00C299E2 /* Release */ = { 457 | isa = XCBuildConfiguration; 458 | buildSettings = { 459 | BUNDLE_LOADER = "$(TEST_HOST)"; 460 | FRAMEWORK_SEARCH_PATHS = ( 461 | "$(SDKROOT)/Developer/Library/Frameworks", 462 | "$(inherited)", 463 | ); 464 | INFOPLIST_FILE = FZCarouselTests/Info.plist; 465 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 466 | PRODUCT_NAME = "$(TARGET_NAME)"; 467 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FZCarousel.app/FZCarousel"; 468 | }; 469 | name = Release; 470 | }; 471 | /* End XCBuildConfiguration section */ 472 | 473 | /* Begin XCConfigurationList section */ 474 | 1D19DC391A5CA0BF00C299E2 /* Build configuration list for PBXProject "FZCarousel" */ = { 475 | isa = XCConfigurationList; 476 | buildConfigurations = ( 477 | 1D19DC5F1A5CA0BF00C299E2 /* Debug */, 478 | 1D19DC601A5CA0BF00C299E2 /* Release */, 479 | ); 480 | defaultConfigurationIsVisible = 0; 481 | defaultConfigurationName = Release; 482 | }; 483 | 1D19DC611A5CA0BF00C299E2 /* Build configuration list for PBXNativeTarget "FZCarousel" */ = { 484 | isa = XCConfigurationList; 485 | buildConfigurations = ( 486 | 1D19DC621A5CA0BF00C299E2 /* Debug */, 487 | 1D19DC631A5CA0BF00C299E2 /* Release */, 488 | ); 489 | defaultConfigurationIsVisible = 0; 490 | defaultConfigurationName = Release; 491 | }; 492 | 1D19DC641A5CA0BF00C299E2 /* Build configuration list for PBXNativeTarget "FZCarouselTests" */ = { 493 | isa = XCConfigurationList; 494 | buildConfigurations = ( 495 | 1D19DC651A5CA0BF00C299E2 /* Debug */, 496 | 1D19DC661A5CA0BF00C299E2 /* Release */, 497 | ); 498 | defaultConfigurationIsVisible = 0; 499 | defaultConfigurationName = Release; 500 | }; 501 | /* End XCConfigurationList section */ 502 | }; 503 | rootObject = 1D19DC361A5CA0BF00C299E2 /* Project object */; 504 | } 505 | -------------------------------------------------------------------------------- /FZCarousel.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FZCarousel.xcodeproj/project.xcworkspace/xcshareddata/FZCarousel.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | FAA2B714-5B3F-4F65-BCC3-FFFF5E9BAA35 9 | IDESourceControlProjectName 10 | FZCarousel 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 14D3542B6BFD95C44275689C8FE17C0EA895878E 14 | gitlab.fuzzhq.com:ios-modules/fzcarouselcollectionviewdelegate.git 15 | 16 | IDESourceControlProjectPath 17 | FZCarousel.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 14D3542B6BFD95C44275689C8FE17C0EA895878E 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | gitlab.fuzzhq.com:ios-modules/fzcarouselcollectionviewdelegate.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 14D3542B6BFD95C44275689C8FE17C0EA895878E 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 14D3542B6BFD95C44275689C8FE17C0EA895878E 36 | IDESourceControlWCCName 37 | FZCarousel 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /FZCarousel.xcodeproj/xcuserdata/noahblake.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /FZCarousel.xcodeproj/xcuserdata/noahblake.xcuserdatad/xcschemes/FZCarousel.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 94 | 100 | 101 | 102 | 103 | 105 | 106 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /FZCarousel.xcodeproj/xcuserdata/noahblake.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | FZCarousel.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 1D19DC3D1A5CA0BF00C299E2 16 | 17 | primary 18 | 19 | 20 | 1D19DC561A5CA0BF00C299E2 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /FZCarousel/FZCarouselCollectionViewDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAPCarouselCollectionViewDelegate.h 3 | // Fuzz Productions 4 | // 5 | // Created by Noah Blake on 6/3/14. 6 | // Copyright (c) 2014 Fuzz Productions, LLC. All rights reserved. 7 | // 8 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0, as well as to the Additional Term regarding proper attribution. 9 | // The latter is located in Term 11 of the License. 10 | // If a copy of the MPL with the Additional Term was not distributed with this file, You can obtain one at http://static.fuzzhq.com/licenses/MPL 11 | 12 | @import UIKit; 13 | 14 | /** 15 | * @description FZCarouselCollectionViewDelegate is an abstract UICollectionViewDelegate that produces an infinitely scrolling carousel. 16 | * 17 | * @discussion Users of this class should begin by subclasssing it. Subclasses should handle all UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, and UICollectionViewDelegate methods that need to be overwritten to produce the desired collectionView layout. 18 | This class, in turn, will handle all "carousel concerns," which include manipulation and syncing of the data array, page control updates, and carousel cranking. 19 | */ 20 | 21 | typedef void (^FZCarouselCollectionViewDelegateDidSelectCellBlock)(UICollectionView *inCollectionView, NSIndexPath *inIndexPath, id inDataForIndexPath); 22 | 23 | @interface FZCarouselCollectionViewDelegate : NSObject 24 | { 25 | @protected NSArray *_dataArray; 26 | } 27 | /** 28 | * @description The block invoked when a cell is selected. 29 | */ 30 | @property (nonatomic, copy) FZCarouselCollectionViewDelegateDidSelectCellBlock didSelectCellBlock; 31 | /** 32 | * @description A page control optionally maintained by the `FZCarouselCollectionViewDelegate`. 33 | */ 34 | @property (nonatomic, strong) IBOutlet UIPageControl *pageControl; 35 | /** 36 | * @description The collectionView managed by `FZCarouselCollectionViewDelegate`. 37 | */ 38 | @property (nonatomic, weak) IBOutlet UICollectionView *collectionView; 39 | /** 40 | * @description The speed at which the carousel cranks. If a lazyCrankInterval is specified, the speed at which the carousel cranks for its first "cycle." 41 | */ 42 | @property (nonatomic, assign) NSTimeInterval defaultCrankInterval; 43 | /** 44 | * @description The speed at which the carousel cranks after the first cycle is complete. 45 | */ 46 | @property (nonatomic, assign) NSTimeInterval lazyCrankInterval; 47 | /** 48 | * @description Determines whether gestures received by the collecitonView cancel carousel movement. By default, YES. 49 | */ 50 | @property (nonatomic, assign) BOOL gestureRecognitionShouldEndCarousel; 51 | 52 | #pragma mark - Constructors - 53 | /** 54 | * @description The default constructor. 55 | * @param inCollectionView The collectionView managed by the `FZCarouselCollectionViewDelegate`. 56 | * @param inDataArray The data array represented in collectionView. 57 | * @param inCrankInterval The speed at which the carousel cranks. 58 | * @return An FZCarouselCollectionViewDelegate configured as specified by the constructor's parameters. 59 | * 60 | */ 61 | + (instancetype)carouselCollectionViewDelegateForCollectionView:(UICollectionView *)inCollectionView dataArray:(NSArray *)inDataArray crankInterval:(NSTimeInterval)inCrankInterval; 62 | /** 63 | * @description A constructor supporting lazy crank intervals. 64 | * @param inCollectionView The collectionView managed by the `FZCarouselCollectionViewDelegate`. 65 | * @param inDataArray The data array represented in collectionView. 66 | * @param inCrankInterval The speed at which the carousel cranks for its first cycle. 67 | * @param inLazyCrankInterval The speed at which the carousel cranks after its first cycle. 68 | * @return An FZCarouselCollectionViewDelegate configured as specified by the constructor's parameters. 69 | * 70 | */ 71 | + (instancetype)carouselCollectionViewDelegateForCollectionView:(UICollectionView *)inCollectionView dataArray:(NSArray *)inArray defaultCrankInterval:(NSTimeInterval)inDefaultCrankInterval lazyCrankInterval:(NSTimeInterval)inLazyCrankInterval; 72 | 73 | #pragma mark - Data setting - 74 | /** 75 | * @description Set the array of data to be represented in the collectionView. 76 | * @parameter inDataArray The array of data represented in the collectionView 77 | * @discussion This array's contents will be multiplied in order to produce the infinitely scrollable effect. Once set, external classes should not attempt to read this value. 78 | */ 79 | - (void)setDataArray:(NSArray *)inDataArray; 80 | 81 | #pragma mark - Carousel control - 82 | /** 83 | * @description Begin carousel movement. 84 | * @discussion Call this method to begin or resume the carousel. 85 | */ 86 | - (void)beginCarousel; 87 | /** 88 | * @description End carousel movement. 89 | * @discussion Call this method to end the carousel. 90 | */ 91 | - (void)endCarousel; 92 | /** 93 | * @description A method for subclasses to implement to provide custom view code for their page controls. 94 | * @discussion Implement this method to customize the carousel's page control. 95 | */ 96 | - (void)configurePageControl; 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /FZCarousel/FZCarouselCollectionViewDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // TAPCarouselCollectionViewDelegate.m 3 | // Fuzz Productions 4 | // 5 | // Created by Noah Blake on 6/3/14. 6 | // Copyright (c) 2014 Fuzz Productions, LLC. All rights reserved. 7 | // 8 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0, as well as to the Additional Term regarding proper attribution. 9 | // The latter is located in Term 11 of the License. 10 | // If a copy of the MPL with the Additional Term was not distributed with this file, You can obtain one at http://static.fuzzhq.com/licenses/MPL 11 | 12 | #import "FZCarouselCollectionViewDelegate.h" 13 | 14 | @interface FZCarouselCollectionViewDelegate () 15 | @property (nonatomic, strong) NSArray *dataArray; 16 | @property (nonatomic, strong) UIPanGestureRecognizer *timerInvalidatingGestureRecognizer; 17 | @property (nonatomic, assign) NSInteger cycleLength; 18 | @property (nonatomic, assign) NSInteger dataMultiplier; 19 | @property (nonatomic, assign) BOOL isLazyScrolling; 20 | @property (nonatomic, strong) NSTimer *timer; 21 | @end 22 | 23 | @implementation FZCarouselCollectionViewDelegate 24 | #pragma mark - Initial configuration - 25 | - (instancetype)init 26 | { 27 | if (self = [super init]) 28 | { 29 | self.gestureRecognitionShouldEndCarousel = YES; 30 | } 31 | return self; 32 | } 33 | 34 | + (instancetype)carouselCollectionViewDelegateForCollectionView:(UICollectionView *)inCollectionView dataArray:(NSArray *)inDataArray crankInterval:(NSTimeInterval)inCrankInterval 35 | { 36 | return [self carouselCollectionViewDelegateForCollectionView:inCollectionView dataArray:inDataArray defaultCrankInterval:inCrankInterval lazyCrankInterval:inCrankInterval]; 37 | } 38 | 39 | + (instancetype)carouselCollectionViewDelegateForCollectionView:(UICollectionView *)inCollectionView dataArray:(NSArray *)inArray defaultCrankInterval:(NSTimeInterval)inDefaultCrankInterval lazyCrankInterval:(NSTimeInterval)inLazyCrankInterval 40 | { 41 | FZCarouselCollectionViewDelegate *rtnDelegate = [[self class] new]; 42 | rtnDelegate.collectionView = inCollectionView; 43 | rtnDelegate.collectionView.pagingEnabled = YES; 44 | inCollectionView.delegate = rtnDelegate; 45 | inCollectionView.dataSource = rtnDelegate; 46 | rtnDelegate.dataArray = inArray; 47 | rtnDelegate.defaultCrankInterval = inDefaultCrankInterval; 48 | rtnDelegate.lazyCrankInterval = inLazyCrankInterval; 49 | [rtnDelegate addPageControl]; 50 | 51 | return rtnDelegate; 52 | } 53 | 54 | #pragma mark - Data setting response - 55 | - (void)setDataArray:(NSArray *)inDataArray 56 | { 57 | NSMutableArray *tmpDataArray = [inDataArray mutableCopy]; 58 | self.cycleLength = tmpDataArray.count; 59 | [tmpDataArray addObjectsFromArray:inDataArray]; 60 | [tmpDataArray addObjectsFromArray:inDataArray]; 61 | self.dataMultiplier = 3; 62 | _dataArray = tmpDataArray.copy; 63 | 64 | [self.collectionView reloadData]; 65 | } 66 | 67 | #pragma mark - Page control - 68 | - (void)setPageControl:(UIPageControl *)pageControl 69 | { 70 | _pageControl = pageControl; 71 | [self updatePageControl]; 72 | } 73 | 74 | - (void)addPageControl 75 | { 76 | _pageControl = [[UIPageControl alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.collectionView.bounds) - 50.0f, CGRectGetWidth(self.collectionView.frame), 40.0f)]; 77 | [self configurePageControl]; 78 | } 79 | 80 | - (void)configurePageControl 81 | { 82 | self.pageControl.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin; 83 | self.pageControl.currentPageIndicatorTintColor = [UIColor grayColor]; 84 | self.pageControl.pageIndicatorTintColor = [UIColor whiteColor]; 85 | self.pageControl.translatesAutoresizingMaskIntoConstraints = NO; 86 | UIView *tmpSuperView = self.collectionView.superview; 87 | if (tmpSuperView) 88 | { 89 | [tmpSuperView addSubview:self.pageControl]; 90 | [tmpSuperView addConstraint:[NSLayoutConstraint constraintWithItem:self.pageControl attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:tmpSuperView attribute:NSLayoutAttributeBottom multiplier:1.0f constant:-5.0f]]; 91 | [tmpSuperView addConstraint:[NSLayoutConstraint constraintWithItem:self.pageControl attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:tmpSuperView attribute:NSLayoutAttributeCenterX multiplier:1.0f constant:0.0f]]; 92 | } 93 | } 94 | 95 | #pragma mark - CollectionView Delegate - 96 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section 97 | { 98 | NSInteger tmpRowCount = self.dataArray.count; 99 | if (tmpRowCount) 100 | { 101 | [self updatePageControl]; 102 | } 103 | return self.dataArray.count; 104 | } 105 | 106 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath 107 | { 108 | return CGSizeMake(CGRectGetWidth(collectionView.frame), CGRectGetHeight(collectionView.frame)); 109 | } 110 | 111 | - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section 112 | { 113 | return 0; 114 | } 115 | - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section 116 | { 117 | return 0; 118 | } 119 | 120 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 121 | { 122 | NSException *tmpException = [NSException exceptionWithName:@"FZCarouselCollectionViewDelegate" reason:@"FZCarouselCollectionViewDelegate is an abstract class. Subclasses are expected to implement collectionView:cellForItemAtIndexPath:." userInfo:nil]; 123 | [tmpException raise]; 124 | return nil; 125 | } 126 | 127 | - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath 128 | { 129 | if (self.didSelectCellBlock) 130 | { 131 | id tmpData = nil;; 132 | if (self.dataArray.count > indexPath.item) 133 | { 134 | tmpData = self.dataArray[indexPath.item]; 135 | } 136 | else 137 | { 138 | NSLog(@"(FZCarouselCollectionViewDelegate) WARNING: Failed to find data object for cell selection at index path: %@", indexPath); 139 | } 140 | 141 | self.didSelectCellBlock(collectionView, indexPath, tmpData); 142 | } 143 | } 144 | 145 | #pragma mark - ScrollView delegate - 146 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView 147 | { 148 | NSInteger tmpCurrentPage = floorf(CGRectGetMidX(scrollView.bounds) / CGRectGetWidth(scrollView.bounds)); 149 | tmpCurrentPage %= self.cycleLength; 150 | self.pageControl.currentPage = tmpCurrentPage; 151 | } 152 | 153 | - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView 154 | { 155 | NSInteger tmpCurrentPage = floorf(CGRectGetMidX(scrollView.bounds) / CGRectGetWidth(scrollView.bounds)); 156 | if (tmpCurrentPage == 0) 157 | { 158 | self.collectionView.contentOffset = CGPointMake(CGRectGetWidth(self.collectionView.frame) * self.cycleLength, 0); 159 | } 160 | else if (tmpCurrentPage == self.dataArray.count - 1) 161 | { 162 | self.collectionView.contentOffset = CGPointMake(CGRectGetWidth(self.collectionView.frame) * (self.cycleLength - 1), 0); 163 | } 164 | } 165 | 166 | #pragma mark - Carousel control - 167 | - (void)updatePageControl 168 | { 169 | self.pageControl.numberOfPages = self.dataArray.count / self.dataMultiplier; 170 | self.pageControl.hidden = (self.cycleLength < 2); 171 | } 172 | 173 | - (void)beginCarousel 174 | { 175 | self.isLazyScrolling = NO; 176 | [self prepareCarouselForInterval:self.defaultCrankInterval]; 177 | } 178 | 179 | - (void)beginLazyCarousel 180 | { 181 | self.isLazyScrolling = YES; 182 | [self prepareCarouselForInterval:self.lazyCrankInterval]; 183 | } 184 | 185 | - (void)prepareCarouselForInterval:(NSTimeInterval)inInterval 186 | { 187 | // Clean up existing trackers. 188 | [self endCarousel]; 189 | 190 | // Add a gesture to disable the crank. 191 | [self enableGestureRecognizer:self.gestureRecognitionShouldEndCarousel]; 192 | 193 | self.timer = [NSTimer scheduledTimerWithTimeInterval:inInterval target:self selector:@selector(crankCarousel:) userInfo:nil repeats:YES]; 194 | } 195 | 196 | - (void)endCarousel 197 | { 198 | [self.timer invalidate]; 199 | self.timer = nil; 200 | if (self.timerInvalidatingGestureRecognizer) 201 | { 202 | [self.collectionView removeGestureRecognizer:self.timerInvalidatingGestureRecognizer]; 203 | self.timerInvalidatingGestureRecognizer = nil; 204 | } 205 | } 206 | 207 | - (void)crankCarousel:(id)sender 208 | { 209 | NSIndexPath *tmpCurrentIndexPath = [[self.collectionView indexPathsForVisibleItems] firstObject]; 210 | NSInteger tmpNextItem = tmpCurrentIndexPath.item + 1; 211 | BOOL tmpHasReachedEndOfCycle = self.cycleLength && tmpNextItem % self.cycleLength == 0; 212 | if (!self.isLazyScrolling && tmpHasReachedEndOfCycle) 213 | { 214 | [self beginLazyCarousel]; 215 | } 216 | 217 | NSIndexPath *tmpNextIndexPath = [NSIndexPath indexPathForItem:tmpCurrentIndexPath.item + 1 inSection:0]; 218 | 219 | if (tmpNextIndexPath.row < (NSInteger)(self.dataArray.count - 1)) 220 | { 221 | [self.collectionView scrollToItemAtIndexPath:tmpNextIndexPath atScrollPosition:UICollectionViewScrollPositionNone animated:YES]; 222 | } 223 | else 224 | { 225 | if ([self.collectionView numberOfItemsInSection:0] > self.cycleLength) 226 | { 227 | [self.collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:MAX(self.cycleLength - 2, 0) inSection:0] atScrollPosition:UICollectionViewScrollPositionNone animated:NO]; 228 | [self.collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:MAX(1, self.cycleLength - 1) inSection:0] atScrollPosition:UICollectionViewScrollPositionNone animated:YES]; 229 | } 230 | } 231 | } 232 | 233 | #pragma mark - Gesture recognizer configuration - 234 | - (void)setGestureRecognitionShouldEndCarousel:(BOOL)inGestureRecognitionShouldEndCarousel 235 | { 236 | _gestureRecognitionShouldEndCarousel = inGestureRecognitionShouldEndCarousel; 237 | [self enableGestureRecognizer:inGestureRecognitionShouldEndCarousel]; 238 | } 239 | 240 | - (void)enableGestureRecognizer:(BOOL)inEnableGestureRecognizer 241 | { 242 | if (inEnableGestureRecognizer) 243 | { 244 | self.timerInvalidatingGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(endCarousel)]; 245 | self.timerInvalidatingGestureRecognizer.cancelsTouchesInView = NO; 246 | self.timerInvalidatingGestureRecognizer.delegate = self; 247 | [self.collectionView addGestureRecognizer:self.timerInvalidatingGestureRecognizer]; 248 | } 249 | else 250 | { 251 | [self.collectionView removeGestureRecognizer:self.timerInvalidatingGestureRecognizer]; 252 | self.timerInvalidatingGestureRecognizer = nil; 253 | } 254 | } 255 | 256 | #pragma mark - Gesture recognizer delegate - 257 | - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer 258 | { 259 | return YES; 260 | } 261 | 262 | - (void)dealloc 263 | { 264 | [self.timer invalidate]; 265 | self.timer = nil; 266 | } 267 | @end 268 | -------------------------------------------------------------------------------- /FZCarousel/FZCarouselView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FZCarouselView.h 3 | // FZCarousel 4 | // 5 | // Created by Sheng Dong on 9/25/15. 6 | // Copyright © 2015 Fuzz Productions, LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "FZCarouselCollectionViewDelegate.h" 12 | 13 | 14 | @interface FZDefaultCarouselCollectionViewDelegate : FZCarouselCollectionViewDelegate 15 | @end 16 | 17 | /** 18 | * @description FZCarouselView is view with default implementation of FZCarouselCollectionViewDelegate that takes an array of images for an infinitely scrolling carousel. 19 | * 20 | * @discussion Use it like a standard view with or without storyboard. 21 | */ 22 | 23 | @interface FZCarouselView : UIView 24 | 25 | @property (readonly, nonatomic) FZDefaultCarouselCollectionViewDelegate *carouselCollectionViewDelegate; 26 | @property (readonly, nonatomic) UICollectionView *collectionView; 27 | 28 | 29 | @property (nonatomic, strong) NSArray *imageArray; 30 | @property (nonatomic) BOOL gestureRecognitionShouldEndCarousel; 31 | @property (nonatomic, assign) NSTimeInterval crankInterval; // Three Seconds by default 32 | 33 | - (void)beginCarousel; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /FZCarousel/FZCarouselView.m: -------------------------------------------------------------------------------- 1 | // 2 | // FZCarouselView.m 3 | // FZCarousel 4 | // 5 | // Created by Sheng Dong on 9/25/15. 6 | // Copyright © 2015 Fuzz Productions, LLC. All rights reserved. 7 | // 8 | 9 | #import "FZCarouselView.h" 10 | 11 | 12 | @interface FZDefaultCarouselCollectionViewCell : UICollectionViewCell 13 | @property (nonatomic, strong) UIImageView *imageView; 14 | @end 15 | 16 | @implementation FZCarouselView 17 | 18 | - (instancetype)initWithCoder:(NSCoder *)aDecoder { 19 | if (self = [super initWithCoder:aDecoder]) { 20 | [self setupCollectionView]; 21 | } 22 | return self; 23 | } 24 | 25 | - (instancetype)initWithFrame:(CGRect)frame { 26 | self = [super initWithFrame:frame]; 27 | if (self) { 28 | _crankInterval = 3.0f; 29 | _gestureRecognitionShouldEndCarousel = false; 30 | [self setupCollectionView]; 31 | 32 | } 33 | return self; 34 | } 35 | 36 | - (void)setupCollectionView { 37 | self.imageArray = [NSArray array]; 38 | 39 | UICollectionViewFlowLayout *flowLayout = [UICollectionViewFlowLayout new]; 40 | [flowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal]; 41 | _collectionView = [[UICollectionView alloc] initWithFrame:self.bounds collectionViewLayout:flowLayout]; 42 | [self.collectionView setTranslatesAutoresizingMaskIntoConstraints:NO]; 43 | [self.collectionView setShowsHorizontalScrollIndicator:NO]; 44 | [self addSubview:self.collectionView]; 45 | NSDictionary *views = NSDictionaryOfVariableBindings(_collectionView); 46 | NSArray *topAndBottom = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_collectionView]|" options:0 metrics:@{} views:views]; 47 | NSArray *leftAndRight = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_collectionView]|" options:0 metrics:@{} views:views]; 48 | [self addConstraints:topAndBottom]; 49 | [self addConstraints:leftAndRight]; 50 | 51 | _carouselCollectionViewDelegate = [FZDefaultCarouselCollectionViewDelegate carouselCollectionViewDelegateForCollectionView:self.collectionView dataArray:self.imageArray crankInterval:self.crankInterval]; 52 | self.carouselCollectionViewDelegate.lazyCrankInterval = self.crankInterval; 53 | } 54 | 55 | - (void)setImageArray:(NSArray *)imageArray { 56 | _imageArray = imageArray; 57 | [self.carouselCollectionViewDelegate setDataArray:_imageArray]; 58 | } 59 | 60 | - (void)setCrankInterval:(NSTimeInterval)crankInterval { 61 | _crankInterval = crankInterval; 62 | [self.carouselCollectionViewDelegate setDefaultCrankInterval:_crankInterval]; 63 | self.carouselCollectionViewDelegate.lazyCrankInterval = self.crankInterval; 64 | } 65 | 66 | - (void)setGestureRecognitionShouldEndCarousel:(BOOL)gestureRecognitionShouldEndCarousel { 67 | _gestureRecognitionShouldEndCarousel = gestureRecognitionShouldEndCarousel; 68 | self.carouselCollectionViewDelegate.gestureRecognitionShouldEndCarousel = self.gestureRecognitionShouldEndCarousel; 69 | } 70 | 71 | - (void)beginCarousel { 72 | [self.carouselCollectionViewDelegate beginCarousel]; 73 | } 74 | 75 | @end 76 | 77 | 78 | 79 | /** 80 | * @description FZDefaultCarouselCollectionViewDelegate is the default implementation of FZCarouselCollectionViewDelegate. It registers the default cell. 81 | * 82 | * @discussion Use it like a standard view with or without storyboard. 83 | */ 84 | 85 | static NSString *const FZDefaultCarouselCollectionViewCellIdentifier = @"FZDefaultCarouselCollectionViewCell"; 86 | 87 | @implementation FZDefaultCarouselCollectionViewDelegate 88 | 89 | + (instancetype)carouselCollectionViewDelegateForCollectionView:(UICollectionView *)inCollectionView 90 | dataArray:(NSArray *)inDataArray 91 | crankInterval:(NSTimeInterval)inCrankInterval { 92 | 93 | [inCollectionView registerClass:[FZDefaultCarouselCollectionViewCell class] forCellWithReuseIdentifier:FZDefaultCarouselCollectionViewCellIdentifier]; 94 | return [super carouselCollectionViewDelegateForCollectionView:inCollectionView dataArray:inDataArray crankInterval:inCrankInterval]; 95 | } 96 | 97 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView 98 | cellForItemAtIndexPath:(NSIndexPath *)indexPath { 99 | 100 | FZDefaultCarouselCollectionViewCell *rtnCell = (FZDefaultCarouselCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:FZDefaultCarouselCollectionViewCellIdentifier forIndexPath:indexPath]; 101 | 102 | if (indexPath.row < _dataArray.count) 103 | { 104 | UIImage *tmpImage = _dataArray[indexPath.row]; 105 | rtnCell.imageView.image = tmpImage; 106 | } 107 | return rtnCell; 108 | } 109 | 110 | @end 111 | 112 | 113 | 114 | 115 | @implementation FZDefaultCarouselCollectionViewCell 116 | 117 | - (instancetype)initWithCoder:(NSCoder *)aDecoder { 118 | if (self = [super initWithCoder:aDecoder]) { 119 | [self setupImageView]; 120 | } 121 | return self; 122 | } 123 | 124 | - (instancetype)initWithFrame:(CGRect)frame { 125 | self = [super initWithFrame:frame]; 126 | if (self) { 127 | [self setupImageView]; 128 | } 129 | return self; 130 | } 131 | 132 | - (void)setupImageView { 133 | self.imageView = [[UIImageView alloc] initWithFrame:CGRectZero]; 134 | [self.imageView setTranslatesAutoresizingMaskIntoConstraints: NO]; 135 | [self addSubview:self.imageView]; 136 | NSDictionary *views = NSDictionaryOfVariableBindings(_imageView); 137 | NSArray *topAndBottom = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_imageView]|" options:0 metrics:@{} views:views]; 138 | NSArray *leftAndRight = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_imageView]|" options:0 metrics:@{} views:views]; 139 | [self addConstraints:topAndBottom]; 140 | [self addConstraints:leftAndRight]; 141 | } 142 | 143 | @end -------------------------------------------------------------------------------- /FZCarouselDemo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-opensource/FZCarousel/9daa398099461a6368d582de7c06099f6c1a1e16/FZCarouselDemo.gif -------------------------------------------------------------------------------- /FZCarouselDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // FZCarousel 4 | // 5 | // Created by Noah Blake on 1/6/15. 6 | // Copyright (c) 2015 Fuzz Productions, LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /FZCarouselDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // FZCarousel 4 | // 5 | // Created by Noah Blake on 1/6/15. 6 | // Copyright (c) 2015 Fuzz Productions, LLC. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | 20 | return YES; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /FZCarouselDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /FZCarouselDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /FZCarouselDemo/Demo/FZDemoCarouselCollectionViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // FZDemoCarouselCollectionViewCell.h 3 | // Fuzz Productions 4 | // 5 | // Created by Noah Blake on 12/8/14. 6 | // Copyright (c) 2014 Fuzz Productions, LLC. All rights reserved. 7 | // 8 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0, as well as to the Additional Term regarding proper attribution. 9 | // The latter is located in Term 11 of the License. 10 | // If a copy of the MPL with the Additional Term was not distributed with this file, You can obtain one at http://static.fuzzhq.com/licenses/MPL 11 | 12 | @import UIKit; 13 | 14 | @interface FZDemoCarouselCollectionViewCell : UICollectionViewCell 15 | @property (weak, nonatomic) IBOutlet UIImageView *imageView; 16 | @end 17 | -------------------------------------------------------------------------------- /FZCarouselDemo/Demo/FZDemoCarouselCollectionViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // FZDemoCarouselCollectionViewCell.m 3 | // Fuzz Productions 4 | // 5 | // Created by Noah Blake on 12/8/14. 6 | // Copyright (c) 2014 Fuzz Productions, LLC. All rights reserved. 7 | // 8 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0, as well as to the Additional Term regarding proper attribution. 9 | // The latter is located in Term 11 of the License. 10 | // If a copy of the MPL with the Additional Term was not distributed with this file, You can obtain one at http://static.fuzzhq.com/licenses/MPL 11 | 12 | #import "FZDemoCarouselCollectionViewCell.h" 13 | 14 | @implementation FZDemoCarouselCollectionViewCell 15 | @end 16 | -------------------------------------------------------------------------------- /FZCarouselDemo/Demo/FZDemoCarouselCollectionViewDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // FZDemoCarouselCollectionViewDelegate.h 3 | // Fuzz Productions 4 | // 5 | // Created by Noah Blake on 12/8/14. 6 | // Copyright (c) 2014 Fuzz Productions, LLC. All rights reserved. 7 | // 8 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0, as well as to the Additional Term regarding proper attribution. 9 | // The latter is located in Term 11 of the License. 10 | // If a copy of the MPL with the Additional Term was not distributed with this file, You can obtain one at http://static.fuzzhq.com/licenses/MPL 11 | 12 | #import "FZCarouselCollectionViewDelegate.h" 13 | 14 | @interface FZDemoCarouselCollectionViewDelegate : FZCarouselCollectionViewDelegate 15 | @end 16 | -------------------------------------------------------------------------------- /FZCarouselDemo/Demo/FZDemoCarouselCollectionViewDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // FZDemoCarouselCollectionViewDelegate.m 3 | // Fuzz Productions 4 | // 5 | // Created by Noah Blake on 12/8/14. 6 | // Copyright (c) 2014 Fuzz Productions, LLC. All rights reserved. 7 | // 8 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0, as well as to the Additional Term regarding proper attribution. 9 | // The latter is located in Term 11 of the License. 10 | // If a copy of the MPL with the Additional Term was not distributed with this file, You can obtain one at http://static.fuzzhq.com/licenses/MPL 11 | 12 | #import "FZDemoCarouselCollectionViewDelegate.h" 13 | 14 | #import "FZDemoCarouselCollectionViewCell.h" 15 | 16 | static NSString *const FZDemoCarouselCollectionViewCellIdentifier = @"FZDemoCarouselCollectionViewCell"; 17 | 18 | @implementation FZDemoCarouselCollectionViewDelegate 19 | 20 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 21 | { 22 | FZDemoCarouselCollectionViewCell *rtnCell = (FZDemoCarouselCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:FZDemoCarouselCollectionViewCellIdentifier forIndexPath:indexPath]; 23 | if (indexPath.row < _dataArray.count) 24 | { 25 | NSString *tmpImageName = _dataArray[indexPath.row]; 26 | rtnCell.imageView.image = [UIImage imageNamed:tmpImageName]; 27 | } 28 | return rtnCell; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /FZCarouselDemo/Demo/FZDemoDefaultCarouselViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FZDemoDefaultCarouselViewController.h 3 | // FZCarousel 4 | // 5 | // Created by Sheng Dong on 9/25/15. 6 | // Copyright © 2015 Fuzz Productions, LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FZDemoDefaultCarouselViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /FZCarouselDemo/Demo/FZDemoDefaultCarouselViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FZDemoDefaultCarouselViewController.m 3 | // FZCarousel 4 | // 5 | // Created by Sheng Dong on 9/25/15. 6 | // Copyright © 2015 Fuzz Productions, LLC. All rights reserved. 7 | // 8 | 9 | #import "FZDemoDefaultCarouselViewController.h" 10 | #import "FZCarouselView.h" 11 | 12 | @interface FZDemoDefaultCarouselViewController () 13 | 14 | @property (weak, nonatomic) IBOutlet FZCarouselView *carouselView; 15 | 16 | @end 17 | 18 | @implementation FZDemoDefaultCarouselViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | [self prepareCarousel]; 23 | } 24 | 25 | - (void)prepareCarousel { 26 | NSArray *imageArray = @[[UIImage imageNamed:@"horse_01.png"], [UIImage imageNamed:@"horse_02.png"], [UIImage imageNamed:@"horse_03.png"], [UIImage imageNamed:@"horse_04.png"]]; 27 | self.carouselView.imageArray = imageArray; 28 | self.carouselView.crankInterval = 2.0f; 29 | [self.carouselView beginCarousel]; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /FZCarouselDemo/Demo/FZDemoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FZDemoViewController.h 3 | // Fuzz Productions 4 | // 5 | // Created by Noah Blake on 11/20/14. 6 | // Copyright (c) 2014 Fuzz Productions, LLC. All rights reserved. 7 | // 8 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0, as well as to the Additional Term regarding proper attribution. 9 | // The latter is located in Term 11 of the License. 10 | // If a copy of the MPL with the Additional Term was not distributed with this file, You can obtain one at http://static.fuzzhq.com/licenses/MPL 11 | 12 | @import UIKit; 13 | 14 | @interface FZDemoViewController : UIViewController 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /FZCarouselDemo/Demo/FZDemoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FZDemoViewController.m 3 | // Fuzz Productions 4 | // 5 | // Created by Noah Blake on 11/20/14. 6 | // Copyright (c) 2014 Fuzz Productions, LLC. All rights reserved. 7 | // 8 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0, as well as to the Additional Term regarding proper attribution. 9 | // The latter is located in Term 11 of the License. 10 | // If a copy of the MPL with the Additional Term was not distributed with this file, You can obtain one at http://static.fuzzhq.com/licenses/MPL 11 | 12 | #import "FZDemoViewController.h" 13 | 14 | #import "FZDemoCarouselCollectionViewDelegate.h" 15 | 16 | @interface FZDemoViewController () 17 | @property (weak, nonatomic) IBOutlet UICollectionView *collectionView; 18 | @property (strong, nonatomic) FZDemoCarouselCollectionViewDelegate *carouselCollectionViewDelegate; 19 | @property (strong, nonatomic) NSArray *dataArray; 20 | @property (weak, nonatomic) IBOutlet UIView *didSelectView; 21 | @property (weak, nonatomic) IBOutlet UILabel *didSelectIndicatorLabel; 22 | @end 23 | 24 | @implementation FZDemoViewController 25 | 26 | - (void)viewDidLoad 27 | { 28 | [super viewDidLoad]; 29 | [self prepareData]; 30 | [self prepareCollectionViewDelegate]; 31 | [self configureView]; 32 | } 33 | 34 | - (void)viewDidAppear:(BOOL)animated 35 | { 36 | [super viewDidAppear:animated]; 37 | [self.carouselCollectionViewDelegate beginCarousel]; 38 | } 39 | 40 | - (void)prepareData 41 | { 42 | self.dataArray = @[@"horse_01.png", @"horse_02.png", @"horse_03.png", @"horse_04.png"]; 43 | } 44 | 45 | - (void)prepareCollectionViewDelegate 46 | { 47 | __weak FZDemoViewController *tmpSelf = self; 48 | self.carouselCollectionViewDelegate = [FZDemoCarouselCollectionViewDelegate carouselCollectionViewDelegateForCollectionView:self.collectionView dataArray:self.dataArray crankInterval:2.0f]; 49 | self.carouselCollectionViewDelegate.didSelectCellBlock = ^(UICollectionView *inCollectionView, NSIndexPath *inIndexPath, id inDataForIndexPath) 50 | { 51 | [tmpSelf showSelectionIndicator:YES withData:inDataForIndexPath]; 52 | }; 53 | } 54 | 55 | - (void)configureView 56 | { 57 | self.didSelectIndicatorLabel.textColor = [UIColor whiteColor]; 58 | self.didSelectView.backgroundColor = [UIColor blackColor]; 59 | self.didSelectView.layer.cornerRadius = 4.0f; 60 | self.didSelectView.alpha = 0.0f; 61 | } 62 | 63 | - (void)showSelectionIndicator:(BOOL)inShowSelectionIndicator withData:(NSString *)inData 64 | { 65 | CGFloat tmpAlpha = 0.0f; 66 | static const CGFloat _animationDuration = 0.5f; 67 | if (inShowSelectionIndicator) 68 | { 69 | tmpAlpha = 1.0f; 70 | self.didSelectIndicatorLabel.text = [NSString stringWithFormat:@"%i", (int)[self.dataArray indexOfObject:inData] + 1]; 71 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(_animationDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), 72 | ^{ 73 | [self showSelectionIndicator:NO withData:nil]; 74 | }); 75 | } 76 | 77 | [UIView animateWithDuration:_animationDuration animations: 78 | ^{ 79 | self.didSelectView.alpha = tmpAlpha; 80 | }]; 81 | } 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /FZCarouselDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /FZCarouselDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | Fuzz.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /FZCarouselDemo/Supporting Files/images/horse_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-opensource/FZCarousel/9daa398099461a6368d582de7c06099f6c1a1e16/FZCarouselDemo/Supporting Files/images/horse_01.png -------------------------------------------------------------------------------- /FZCarouselDemo/Supporting Files/images/horse_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-opensource/FZCarousel/9daa398099461a6368d582de7c06099f6c1a1e16/FZCarouselDemo/Supporting Files/images/horse_02.png -------------------------------------------------------------------------------- /FZCarouselDemo/Supporting Files/images/horse_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-opensource/FZCarousel/9daa398099461a6368d582de7c06099f6c1a1e16/FZCarouselDemo/Supporting Files/images/horse_03.png -------------------------------------------------------------------------------- /FZCarouselDemo/Supporting Files/images/horse_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ml-opensource/FZCarousel/9daa398099461a6368d582de7c06099f6c1a1e16/FZCarouselDemo/Supporting Files/images/horse_04.png -------------------------------------------------------------------------------- /FZCarouselDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FZCarousel 4 | // 5 | // Created by Noah Blake on 1/6/15. 6 | // Copyright (c) 2015 Fuzz Productions, LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /FZCarouselTests/FZCarouselTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // FZCarouselCollectionViewDelegateTests.m 3 | // FZCarouselCollectionViewDelegateTests 4 | // 5 | // Created by Noah Blake on 11/20/14. 6 | // Copyright (c) 2014 Fuzz Productions, LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface FZCarouselCollectionViewDelegateTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation FZCarouselCollectionViewDelegateTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /FZCarouselTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | Fuzz.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This software is licensed under the MPL 2.0 license, with an added 2 | attribution clause described under Term 11. In short, the license 3 | requires attribution, as shown in Exhibit C, for any commercial 4 | product. Open source projects may omit the attribution. The attribution 5 | clause is largely based on the CPAL license. 6 | 7 | Mozilla Public License Version 2.0 8 | ================================== 9 | 10 | 1. Definitions 11 | -------------- 12 | 13 | 1.1. "Contributor" 14 | means each individual or legal entity that creates, contributes to 15 | the creation of, or owns Covered Software. 16 | 17 | 1.2. "Contributor Version" 18 | means the combination of the Contributions of others (if any) used 19 | by a Contributor and that particular Contributor's Contribution. 20 | 21 | 1.3. "Contribution" 22 | means Covered Software of a particular Contributor. 23 | 24 | 1.4. "Covered Software" 25 | means Source Code Form to which the initial Contributor has attached 26 | the notice in Exhibit A, the Executable Form of such Source Code 27 | Form, and Modifications of such Source Code Form, in each case 28 | including portions thereof. 29 | 30 | 1.5. "Incompatible With Secondary Licenses" 31 | means 32 | 33 | (a) that the initial Contributor has attached the notice described 34 | in Exhibit B to the Covered Software; or 35 | 36 | (b) that the Covered Software was made available under the terms of 37 | version 1.1 or earlier of the License, but not also under the 38 | terms of a Secondary License. 39 | 40 | 1.6. "Executable Form" 41 | means any form of the work other than Source Code Form. 42 | 43 | 1.7. "Larger Work" 44 | means a work that combines Covered Software with other material, in 45 | a separate file or files, that is not Covered Software. 46 | 47 | 1.8. "License" 48 | means this document. 49 | 50 | 1.9. "Licensable" 51 | means having the right to grant, to the maximum extent possible, 52 | whether at the time of the initial grant or subsequently, any and 53 | all of the rights conveyed by this License. 54 | 55 | 1.10. "Modifications" 56 | means any of the following: 57 | 58 | (a) any file in Source Code Form that results from an addition to, 59 | deletion from, or modification of the contents of Covered 60 | Software; or 61 | 62 | (b) any new file in Source Code Form that contains any Covered 63 | Software. 64 | 65 | 1.11. "Patent Claims" of a Contributor 66 | means any patent claim(s), including without limitation, method, 67 | process, and apparatus claims, in any patent Licensable by such 68 | Contributor that would be infringed, but for the grant of the 69 | License, by the making, using, selling, offering for sale, having 70 | made, import, or transfer of either its Contributions or its 71 | Contributor Version. 72 | 73 | 1.12. "Secondary License" 74 | means either the GNU General Public License, Version 2.0, the GNU 75 | Lesser General Public License, Version 2.1, the GNU Affero General 76 | Public License, Version 3.0, or any later versions of those 77 | licenses. 78 | 79 | 1.13. "Source Code Form" 80 | means the form of the work preferred for making modifications. 81 | 82 | 1.14. "You" (or "Your") 83 | means an individual or a legal entity exercising rights under this 84 | License. For legal entities, "You" includes any entity that 85 | controls, is controlled by, or is under common control with You. For 86 | purposes of this definition, "control" means (a) the power, direct 87 | or indirect, to cause the direction or management of such entity, 88 | whether by contract or otherwise, or (b) ownership of more than 89 | fifty percent (50%) of the outstanding shares or beneficial 90 | ownership of such entity. 91 | 92 | 2. License Grants and Conditions 93 | -------------------------------- 94 | 95 | 2.1. Grants 96 | 97 | Each Contributor hereby grants You a world-wide, royalty-free, 98 | non-exclusive license: 99 | 100 | (a) under intellectual property rights (other than patent or trademark) 101 | Licensable by such Contributor to use, reproduce, make available, 102 | modify, display, perform, distribute, and otherwise exploit its 103 | Contributions, either on an unmodified basis, with Modifications, or 104 | as part of a Larger Work; and 105 | 106 | (b) under Patent Claims of such Contributor to make, use, sell, offer 107 | for sale, have made, import, and otherwise transfer either its 108 | Contributions or its Contributor Version. 109 | 110 | 2.2. Effective Date 111 | 112 | The licenses granted in Section 2.1 with respect to any Contribution 113 | become effective for each Contribution on the date the Contributor first 114 | distributes such Contribution. 115 | 116 | 2.3. Limitations on Grant Scope 117 | 118 | The licenses granted in this Section 2 are the only rights granted under 119 | this License. No additional rights or licenses will be implied from the 120 | distribution or licensing of Covered Software under this License. 121 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 122 | Contributor: 123 | 124 | (a) for any code that a Contributor has removed from Covered Software; 125 | or 126 | 127 | (b) for infringements caused by: (i) Your and any other third party's 128 | modifications of Covered Software, or (ii) the combination of its 129 | Contributions with other software (except as part of its Contributor 130 | Version); or 131 | 132 | (c) under Patent Claims infringed by Covered Software in the absence of 133 | its Contributions. 134 | 135 | This License does not grant any rights in the trademarks, service marks, 136 | or logos of any Contributor (except as may be necessary to comply with 137 | the notice requirements in Section 3.4). 138 | 139 | 2.4. Subsequent Licenses 140 | 141 | No Contributor makes additional grants as a result of Your choice to 142 | distribute the Covered Software under a subsequent version of this 143 | License (see Section 10.2) or under the terms of a Secondary License (if 144 | permitted under the terms of Section 3.3). 145 | 146 | 2.5. Representation 147 | 148 | Each Contributor represents that the Contributor believes its 149 | Contributions are its original creation(s) or it has sufficient rights 150 | to grant the rights to its Contributions conveyed by this License. 151 | 152 | 2.6. Fair Use 153 | 154 | This License is not intended to limit any rights You have under 155 | applicable copyright doctrines of fair use, fair dealing, or other 156 | equivalents. 157 | 158 | 2.7. Conditions 159 | 160 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 161 | in Section 2.1. 162 | 163 | 3. Responsibilities 164 | ------------------- 165 | 166 | 3.1. Distribution of Source Form 167 | 168 | All distribution of Covered Software in Source Code Form, including any 169 | Modifications that You create or to which You contribute, must be under 170 | the terms of this License. You must inform recipients that the Source 171 | Code Form of the Covered Software is governed by the terms of this 172 | License, and how they can obtain a copy of this License. You may not 173 | attempt to alter or restrict the recipients' rights in the Source Code 174 | Form. 175 | 176 | 3.2. Distribution of Executable Form 177 | 178 | If You distribute Covered Software in Executable Form then: 179 | 180 | (a) such Covered Software must also be made available in Source Code 181 | Form, as described in Section 3.1, and You must inform recipients of 182 | the Executable Form how they can obtain a copy of such Source Code 183 | Form by reasonable means in a timely manner, at a charge no more 184 | than the cost of distribution to the recipient; and 185 | 186 | (b) You may distribute such Executable Form under the terms of this 187 | License, or sublicense it under different terms, provided that the 188 | license for the Executable Form does not attempt to limit or alter 189 | the recipients' rights in the Source Code Form under this License. 190 | 191 | 3.3. Distribution of a Larger Work 192 | 193 | You may create and distribute a Larger Work under terms of Your choice, 194 | provided that You also comply with the requirements of this License for 195 | the Covered Software. If the Larger Work is a combination of Covered 196 | Software with a work governed by one or more Secondary Licenses, and the 197 | Covered Software is not Incompatible With Secondary Licenses, this 198 | License permits You to additionally distribute such Covered Software 199 | under the terms of such Secondary License(s), so that the recipient of 200 | the Larger Work may, at their option, further distribute the Covered 201 | Software under the terms of either this License or such Secondary 202 | License(s). 203 | 204 | 3.4. Notices 205 | 206 | You may not remove or alter the substance of any license notices 207 | (including copyright notices, patent notices, disclaimers of warranty, 208 | or limitations of liability) contained within the Source Code Form of 209 | the Covered Software, except that You may alter any license notices to 210 | the extent required to remedy known factual inaccuracies. 211 | 212 | 3.5. Application of Additional Terms 213 | 214 | You may choose to offer, and to charge a fee for, warranty, support, 215 | indemnity or liability obligations to one or more recipients of Covered 216 | Software. However, You may do so only on Your own behalf, and not on 217 | behalf of any Contributor. You must make it absolutely clear that any 218 | such warranty, support, indemnity, or liability obligation is offered by 219 | You alone, and You hereby agree to indemnify every Contributor for any 220 | liability incurred by such Contributor as a result of warranty, support, 221 | indemnity or liability terms You offer. You may include additional 222 | disclaimers of warranty and limitations of liability specific to any 223 | jurisdiction. 224 | 225 | 4. Inability to Comply Due to Statute or Regulation 226 | --------------------------------------------------- 227 | 228 | If it is impossible for You to comply with any of the terms of this 229 | License with respect to some or all of the Covered Software due to 230 | statute, judicial order, or regulation then You must: (a) comply with 231 | the terms of this License to the maximum extent possible; and (b) 232 | describe the limitations and the code they affect. Such description must 233 | be placed in a text file included with all distributions of the Covered 234 | Software under this License. Except to the extent prohibited by statute 235 | or regulation, such description must be sufficiently detailed for a 236 | recipient of ordinary skill to be able to understand it. 237 | 238 | 5. Termination 239 | -------------- 240 | 241 | 5.1. The rights granted under this License will terminate automatically 242 | if You fail to comply with any of its terms. However, if You become 243 | compliant, then the rights granted under this License from a particular 244 | Contributor are reinstated (a) provisionally, unless and until such 245 | Contributor explicitly and finally terminates Your grants, and (b) on an 246 | ongoing basis, if such Contributor fails to notify You of the 247 | non-compliance by some reasonable means prior to 60 days after You have 248 | come back into compliance. Moreover, Your grants from a particular 249 | Contributor are reinstated on an ongoing basis if such Contributor 250 | notifies You of the non-compliance by some reasonable means, this is the 251 | first time You have received notice of non-compliance with this License 252 | from such Contributor, and You become compliant prior to 30 days after 253 | Your receipt of the notice. 254 | 255 | 5.2. If You initiate litigation against any entity by asserting a patent 256 | infringement claim (excluding declaratory judgment actions, 257 | counter-claims, and cross-claims) alleging that a Contributor Version 258 | directly or indirectly infringes any patent, then the rights granted to 259 | You by any and all Contributors for the Covered Software under Section 260 | 2.1 of this License shall terminate. 261 | 262 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 263 | end user license agreements (excluding distributors and resellers) which 264 | have been validly granted by You or Your distributors under this License 265 | prior to termination shall survive termination. 266 | 267 | ************************************************************************ 268 | * * 269 | * 6. Disclaimer of Warranty * 270 | * ------------------------- * 271 | * * 272 | * Covered Software is provided under this License on an "as is" * 273 | * basis, without warranty of any kind, either expressed, implied, or * 274 | * statutory, including, without limitation, warranties that the * 275 | * Covered Software is free of defects, merchantable, fit for a * 276 | * particular purpose or non-infringing. The entire risk as to the * 277 | * quality and performance of the Covered Software is with You. * 278 | * Should any Covered Software prove defective in any respect, You * 279 | * (not any Contributor) assume the cost of any necessary servicing, * 280 | * repair, or correction. This disclaimer of warranty constitutes an * 281 | * essential part of this License. No use of any Covered Software is * 282 | * authorized under this License except under this disclaimer. * 283 | * * 284 | ************************************************************************ 285 | 286 | ************************************************************************ 287 | * * 288 | * 7. Limitation of Liability * 289 | * -------------------------- * 290 | * * 291 | * Under no circumstances and under no legal theory, whether tort * 292 | * (including negligence), contract, or otherwise, shall any * 293 | * Contributor, or anyone who distributes Covered Software as * 294 | * permitted above, be liable to You for any direct, indirect, * 295 | * special, incidental, or consequential damages of any character * 296 | * including, without limitation, damages for lost profits, loss of * 297 | * goodwill, work stoppage, computer failure or malfunction, or any * 298 | * and all other commercial damages or losses, even if such party * 299 | * shall have been informed of the possibility of such damages. This * 300 | * limitation of liability shall not apply to liability for death or * 301 | * personal injury resulting from such party's negligence to the * 302 | * extent applicable law prohibits such limitation. Some * 303 | * jurisdictions do not allow the exclusion or limitation of * 304 | * incidental or consequential damages, so this exclusion and * 305 | * limitation may not apply to You. * 306 | * * 307 | ************************************************************************ 308 | 309 | 8. Litigation 310 | ------------- 311 | 312 | Any litigation relating to this License may be brought only in the 313 | courts of a jurisdiction where the defendant maintains its principal 314 | place of business and such litigation shall be governed by laws of that 315 | jurisdiction, without reference to its conflict-of-law provisions. 316 | Nothing in this Section shall prevent a party's ability to bring 317 | cross-claims or counter-claims. 318 | 319 | 9. Miscellaneous 320 | ---------------- 321 | 322 | This License represents the complete agreement concerning the subject 323 | matter hereof. If any provision of this License is held to be 324 | unenforceable, such provision shall be reformed only to the extent 325 | necessary to make it enforceable. Any law or regulation which provides 326 | that the language of a contract shall be construed against the drafter 327 | shall not be used to construe this License against a Contributor. 328 | 329 | 10. Versions of the License 330 | --------------------------- 331 | 332 | 10.1. New Versions 333 | 334 | Mozilla Foundation is the license steward. Except as provided in Section 335 | 10.3, no one other than the license steward has the right to modify or 336 | publish new versions of this License. Each version will be given a 337 | distinguishing version number. 338 | 339 | 10.2. Effect of New Versions 340 | 341 | You may distribute the Covered Software under the terms of the version 342 | of the License under which You originally received the Covered Software, 343 | or under the terms of any subsequent version published by the license 344 | steward. 345 | 346 | 10.3. Modified Versions 347 | 348 | If you create software not governed by this License, and you want to 349 | create a new license for such software, you may create and use a 350 | modified version of this License if you rename the license and remove 351 | any references to the name of the license steward (except to note that 352 | such modified license differs from this License). 353 | 354 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 355 | Licenses 356 | 357 | If You choose to distribute Source Code Form that is Incompatible With 358 | Secondary Licenses under the terms of this version of the License, the 359 | notice described in Exhibit B of this License must be attached. 360 | 361 | 11. Additional Term: Attribution 362 | -------------------------------- 363 | 364 | For any Larger Work, defined as a work which combines Covered Code or 365 | portions thereof with code not governed by the terms of the license, 366 | proper attribution to the Original Developer must be made as shown in 367 | Exhibit C ("Attribution Information"). A prominent display of the 368 | Original Developer’s Attribution Information (as defined below) must 369 | occur on the graphic user interface employed by the end user to access 370 | such Covered Code (which may include display on a splash screen). 371 | 372 | If the access by the end user to the Executable and Source Code does 373 | not create a graphic user interface for access to the Covered Code, 374 | this obligation shall not apply. 375 | 376 | If Exhibit C does not include any Attribution Information, then 377 | there are no requirements for You to display any Attribution 378 | Information of the Original Developer. 379 | 380 | Exhibit A - Source Code Form License Notice 381 | ------------------------------------------- 382 | 383 | This Source Code Form is subject to the terms of the Mozilla Public 384 | License, v. 2.0, as well as to the Additional Term regarding proper 385 | attribution. The latter is located in Term 11 of the License. 386 | If a copy of the MPL with the Additional Term was not distributed 387 | with this file, You can obtain one at http://static.fuzzhq.com/licenses/MPL 388 | 389 | If it is not possible or desirable to put the notice in a particular 390 | file, then You may include the notice in a location (such as a LICENSE 391 | file in a relevant directory) where a recipient would be likely to look 392 | for such a notice. 393 | 394 | You may add additional accurate notices of copyright ownership. 395 | 396 | Exhibit B - "Incompatible With Secondary Licenses" Notice 397 | --------------------------------------------------------- 398 | 399 | This Source Code Form is "Incompatible With Secondary Licenses", as 400 | defined by the Mozilla Public License, v. 2.0. 401 | 402 | Exhibit C - Attribution Information 403 | ----------------------------------- 404 | Attribution Copyright Notice: Copyright (c) 2014 Fuzz Productions, LLC 405 | 406 | Attribution URL: http://fuzzproductions.com 407 | 408 | Graphic Image as provided in the Covered Code: 409 | http://static.fuzzhq.com/logo.png 410 | 411 | Display of Attribution Information is required in Larger Works, which are 412 | defined as works that combine Covered Code or portions thereof with 413 | code not governed by the terms of the license. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![FZCarousel](FZCarousel.png) 2 | 3 | ## Demo 4 | ![demo](FZCarouselDemo.gif) 5 | 6 | #### Introduction 7 | FZCarouselCollectionViewDelegate provides a straightforward, lightweight interface for producing an "infinitely" scrolling carousel. 8 | 9 | ## Usage 10 | 11 | #### Implementing a subclass 12 | 13 | Users of this class should begin by subclassing it. Subclasses should handle all UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, and UICollectionViewDelegate methods that need to be overwritten to produce the desired collectionView layout. At minimum, it is expected that users will overwrite -collectionView:cellForItemAtIndexPath:, and an exception will be thrown if this is not the case. 14 | 15 | This class, in turn, will handle all "carousel concerns," which include manipulation and syncing of the data array, page control updates, and, of course, carousel cranking. 16 | 17 | #### Standard Configuration 18 | ```obj-c 19 | self.carouselCollectionViewDelegate = [FZDemoCarouselCollectionViewDelegate carouselCollectionViewDelegateForCollectionView:self.collectionView dataArray:self.dataArray defaultCrankInterval:2.0f lazyCrankInterval:2.5f]; 20 | ``` 21 | 22 | #### Responding to cell selection 23 | ```obj-c 24 | self.carouselCollectionViewDelegate.didSelectCellBlock = 25 | ^(UICollectionView *inCollectionView, NSIndexPath *inIndexPath, id inDataForIndexPath) 26 | { 27 | [tmpSelf showSelectionIndicator:YES withData:inDataForIndexPath]; 28 | }; 29 | ``` 30 | 31 | #### Controlling the carousel 32 | ```obj-c 33 | [self.carouselCollectionViewDelegate beginCarousel]; 34 | [self.carouselCollectionViewDelegate endCarousel]; 35 | ``` --------------------------------------------------------------------------------