├── .gitignore ├── KKPagedFlowView.xcodeproj └── project.pbxproj ├── KKPagedFlowView ├── Info.plist ├── KKPagedFlowView.h ├── PagedFlowView.h └── PagedFlowView.m ├── KKPagedFlowViewDemo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── 0.imageset │ │ ├── 0.png │ │ └── Contents.json │ ├── 1.imageset │ │ ├── 1.png │ │ └── Contents.json │ ├── 2.imageset │ │ ├── 2.png │ │ └── Contents.json │ ├── 3.imageset │ │ ├── 3.png │ │ └── Contents.json │ ├── 4.imageset │ │ ├── 4.png │ │ └── Contents.json │ ├── 5.imageset │ │ ├── 5.png │ │ └── Contents.json │ ├── 6.imageset │ │ ├── 6.png │ │ └── Contents.json │ ├── 7.imageset │ │ ├── 7.png │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── README.md └── license.txt /.gitignore: -------------------------------------------------------------------------------- 1 | project.xcworkspace 2 | xcuserdata -------------------------------------------------------------------------------- /KKPagedFlowView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A337889D1C48DEAF001B467E /* KKPagedFlowView.h in Headers */ = {isa = PBXBuildFile; fileRef = A337889C1C48DEAF001B467E /* KKPagedFlowView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | A33788AA1C48DEEF001B467E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = A33788A91C48DEEF001B467E /* main.m */; }; 12 | A33788AD1C48DEEF001B467E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A33788AC1C48DEEF001B467E /* AppDelegate.m */; }; 13 | A33788B01C48DEEF001B467E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A33788AF1C48DEEF001B467E /* ViewController.m */; }; 14 | A33788B31C48DEEF001B467E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A33788B11C48DEEF001B467E /* Main.storyboard */; }; 15 | A33788B51C48DEEF001B467E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A33788B41C48DEEF001B467E /* Assets.xcassets */; }; 16 | A33788B81C48DEEF001B467E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A33788B61C48DEEF001B467E /* LaunchScreen.storyboard */; }; 17 | A33788BF1C48E098001B467E /* PagedFlowView.m in Sources */ = {isa = PBXBuildFile; fileRef = A33788BD1C48E098001B467E /* PagedFlowView.m */; }; 18 | A33788C01C48E098001B467E /* PagedFlowView.h in Headers */ = {isa = PBXBuildFile; fileRef = A33788BE1C48E098001B467E /* PagedFlowView.h */; }; 19 | A33788C11C48E237001B467E /* KKPagedFlowView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A337889A1C48DEAF001B467E /* KKPagedFlowView.framework */; }; 20 | A33788C21C48E237001B467E /* KKPagedFlowView.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A337889A1C48DEAF001B467E /* KKPagedFlowView.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | A33788C31C48E237001B467E /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = A3FB09001504D92500EE9194 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = A33788991C48DEAF001B467E; 29 | remoteInfo = KKPagedFlowView; 30 | }; 31 | /* End PBXContainerItemProxy section */ 32 | 33 | /* Begin PBXCopyFilesBuildPhase section */ 34 | A33788C51C48E237001B467E /* Embed Frameworks */ = { 35 | isa = PBXCopyFilesBuildPhase; 36 | buildActionMask = 2147483647; 37 | dstPath = ""; 38 | dstSubfolderSpec = 10; 39 | files = ( 40 | A33788C21C48E237001B467E /* KKPagedFlowView.framework in Embed Frameworks */, 41 | ); 42 | name = "Embed Frameworks"; 43 | runOnlyForDeploymentPostprocessing = 0; 44 | }; 45 | /* End PBXCopyFilesBuildPhase section */ 46 | 47 | /* Begin PBXFileReference section */ 48 | A337889A1C48DEAF001B467E /* KKPagedFlowView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = KKPagedFlowView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | A337889C1C48DEAF001B467E /* KKPagedFlowView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KKPagedFlowView.h; sourceTree = ""; }; 50 | A337889E1C48DEAF001B467E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | A33788A61C48DEEF001B467E /* KKPagedFlowViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KKPagedFlowViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | A33788A91C48DEEF001B467E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 53 | A33788AB1C48DEEF001B467E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 54 | A33788AC1C48DEEF001B467E /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 55 | A33788AE1C48DEEF001B467E /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 56 | A33788AF1C48DEEF001B467E /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 57 | A33788B21C48DEEF001B467E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 58 | A33788B41C48DEEF001B467E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 59 | A33788B71C48DEEF001B467E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 60 | A33788B91C48DEEF001B467E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 61 | A33788BD1C48E098001B467E /* PagedFlowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PagedFlowView.m; sourceTree = ""; }; 62 | A33788BE1C48E098001B467E /* PagedFlowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PagedFlowView.h; sourceTree = ""; }; 63 | A3FB090D1504D92500EE9194 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 64 | A3FB090F1504D92500EE9194 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 65 | A3FB09111504D92500EE9194 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 66 | A3FB094B1505084400EE9194 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 67 | /* End PBXFileReference section */ 68 | 69 | /* Begin PBXFrameworksBuildPhase section */ 70 | A33788961C48DEAF001B467E /* Frameworks */ = { 71 | isa = PBXFrameworksBuildPhase; 72 | buildActionMask = 2147483647; 73 | files = ( 74 | ); 75 | runOnlyForDeploymentPostprocessing = 0; 76 | }; 77 | A33788A31C48DEEF001B467E /* Frameworks */ = { 78 | isa = PBXFrameworksBuildPhase; 79 | buildActionMask = 2147483647; 80 | files = ( 81 | A33788C11C48E237001B467E /* KKPagedFlowView.framework in Frameworks */, 82 | ); 83 | runOnlyForDeploymentPostprocessing = 0; 84 | }; 85 | /* End PBXFrameworksBuildPhase section */ 86 | 87 | /* Begin PBXGroup section */ 88 | A337889B1C48DEAF001B467E /* KKPagedFlowView */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | A33788BE1C48E098001B467E /* PagedFlowView.h */, 92 | A33788BD1C48E098001B467E /* PagedFlowView.m */, 93 | A337889C1C48DEAF001B467E /* KKPagedFlowView.h */, 94 | A337889E1C48DEAF001B467E /* Info.plist */, 95 | ); 96 | path = KKPagedFlowView; 97 | sourceTree = ""; 98 | }; 99 | A33788A71C48DEEF001B467E /* KKPagedFlowViewDemo */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | A33788AB1C48DEEF001B467E /* AppDelegate.h */, 103 | A33788AC1C48DEEF001B467E /* AppDelegate.m */, 104 | A33788AE1C48DEEF001B467E /* ViewController.h */, 105 | A33788AF1C48DEEF001B467E /* ViewController.m */, 106 | A33788B11C48DEEF001B467E /* Main.storyboard */, 107 | A33788B41C48DEEF001B467E /* Assets.xcassets */, 108 | A33788B61C48DEEF001B467E /* LaunchScreen.storyboard */, 109 | A33788B91C48DEEF001B467E /* Info.plist */, 110 | A33788A81C48DEEF001B467E /* Supporting Files */, 111 | ); 112 | path = KKPagedFlowViewDemo; 113 | sourceTree = ""; 114 | }; 115 | A33788A81C48DEEF001B467E /* Supporting Files */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | A33788A91C48DEEF001B467E /* main.m */, 119 | ); 120 | name = "Supporting Files"; 121 | sourceTree = ""; 122 | }; 123 | A3FB08FE1504D92500EE9194 = { 124 | isa = PBXGroup; 125 | children = ( 126 | A337889B1C48DEAF001B467E /* KKPagedFlowView */, 127 | A33788A71C48DEEF001B467E /* KKPagedFlowViewDemo */, 128 | A3FB090C1504D92500EE9194 /* Frameworks */, 129 | A3FB090A1504D92500EE9194 /* Products */, 130 | ); 131 | sourceTree = ""; 132 | }; 133 | A3FB090A1504D92500EE9194 /* Products */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | A337889A1C48DEAF001B467E /* KKPagedFlowView.framework */, 137 | A33788A61C48DEEF001B467E /* KKPagedFlowViewDemo.app */, 138 | ); 139 | name = Products; 140 | sourceTree = ""; 141 | }; 142 | A3FB090C1504D92500EE9194 /* Frameworks */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | A3FB094B1505084400EE9194 /* QuartzCore.framework */, 146 | A3FB090D1504D92500EE9194 /* UIKit.framework */, 147 | A3FB090F1504D92500EE9194 /* Foundation.framework */, 148 | A3FB09111504D92500EE9194 /* CoreGraphics.framework */, 149 | ); 150 | name = Frameworks; 151 | sourceTree = ""; 152 | }; 153 | /* End PBXGroup section */ 154 | 155 | /* Begin PBXHeadersBuildPhase section */ 156 | A33788971C48DEAF001B467E /* Headers */ = { 157 | isa = PBXHeadersBuildPhase; 158 | buildActionMask = 2147483647; 159 | files = ( 160 | A337889D1C48DEAF001B467E /* KKPagedFlowView.h in Headers */, 161 | A33788C01C48E098001B467E /* PagedFlowView.h in Headers */, 162 | ); 163 | runOnlyForDeploymentPostprocessing = 0; 164 | }; 165 | /* End PBXHeadersBuildPhase section */ 166 | 167 | /* Begin PBXNativeTarget section */ 168 | A33788991C48DEAF001B467E /* KKPagedFlowView */ = { 169 | isa = PBXNativeTarget; 170 | buildConfigurationList = A337889F1C48DEAF001B467E /* Build configuration list for PBXNativeTarget "KKPagedFlowView" */; 171 | buildPhases = ( 172 | A33788951C48DEAF001B467E /* Sources */, 173 | A33788961C48DEAF001B467E /* Frameworks */, 174 | A33788971C48DEAF001B467E /* Headers */, 175 | A33788981C48DEAF001B467E /* Resources */, 176 | ); 177 | buildRules = ( 178 | ); 179 | dependencies = ( 180 | ); 181 | name = KKPagedFlowView; 182 | productName = KKPagedFlowView; 183 | productReference = A337889A1C48DEAF001B467E /* KKPagedFlowView.framework */; 184 | productType = "com.apple.product-type.framework"; 185 | }; 186 | A33788A51C48DEEF001B467E /* KKPagedFlowViewDemo */ = { 187 | isa = PBXNativeTarget; 188 | buildConfigurationList = A33788BA1C48DEEF001B467E /* Build configuration list for PBXNativeTarget "KKPagedFlowViewDemo" */; 189 | buildPhases = ( 190 | A33788A21C48DEEF001B467E /* Sources */, 191 | A33788A31C48DEEF001B467E /* Frameworks */, 192 | A33788A41C48DEEF001B467E /* Resources */, 193 | A33788C51C48E237001B467E /* Embed Frameworks */, 194 | ); 195 | buildRules = ( 196 | ); 197 | dependencies = ( 198 | A33788C41C48E237001B467E /* PBXTargetDependency */, 199 | ); 200 | name = KKPagedFlowViewDemo; 201 | productName = KKPagedFlowViewDemo; 202 | productReference = A33788A61C48DEEF001B467E /* KKPagedFlowViewDemo.app */; 203 | productType = "com.apple.product-type.application"; 204 | }; 205 | /* End PBXNativeTarget section */ 206 | 207 | /* Begin PBXProject section */ 208 | A3FB09001504D92500EE9194 /* Project object */ = { 209 | isa = PBXProject; 210 | attributes = { 211 | LastUpgradeCheck = 0720; 212 | ORGANIZATIONNAME = Taobao.com; 213 | TargetAttributes = { 214 | A33788991C48DEAF001B467E = { 215 | CreatedOnToolsVersion = 7.2; 216 | }; 217 | A33788A51C48DEEF001B467E = { 218 | CreatedOnToolsVersion = 7.2; 219 | }; 220 | }; 221 | }; 222 | buildConfigurationList = A3FB09031504D92500EE9194 /* Build configuration list for PBXProject "KKPagedFlowView" */; 223 | compatibilityVersion = "Xcode 3.2"; 224 | developmentRegion = English; 225 | hasScannedForEncodings = 0; 226 | knownRegions = ( 227 | en, 228 | Base, 229 | ); 230 | mainGroup = A3FB08FE1504D92500EE9194; 231 | productRefGroup = A3FB090A1504D92500EE9194 /* Products */; 232 | projectDirPath = ""; 233 | projectRoot = ""; 234 | targets = ( 235 | A33788991C48DEAF001B467E /* KKPagedFlowView */, 236 | A33788A51C48DEEF001B467E /* KKPagedFlowViewDemo */, 237 | ); 238 | }; 239 | /* End PBXProject section */ 240 | 241 | /* Begin PBXResourcesBuildPhase section */ 242 | A33788981C48DEAF001B467E /* Resources */ = { 243 | isa = PBXResourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | ); 247 | runOnlyForDeploymentPostprocessing = 0; 248 | }; 249 | A33788A41C48DEEF001B467E /* Resources */ = { 250 | isa = PBXResourcesBuildPhase; 251 | buildActionMask = 2147483647; 252 | files = ( 253 | A33788B81C48DEEF001B467E /* LaunchScreen.storyboard in Resources */, 254 | A33788B51C48DEEF001B467E /* Assets.xcassets in Resources */, 255 | A33788B31C48DEEF001B467E /* Main.storyboard in Resources */, 256 | ); 257 | runOnlyForDeploymentPostprocessing = 0; 258 | }; 259 | /* End PBXResourcesBuildPhase section */ 260 | 261 | /* Begin PBXSourcesBuildPhase section */ 262 | A33788951C48DEAF001B467E /* Sources */ = { 263 | isa = PBXSourcesBuildPhase; 264 | buildActionMask = 2147483647; 265 | files = ( 266 | A33788BF1C48E098001B467E /* PagedFlowView.m in Sources */, 267 | ); 268 | runOnlyForDeploymentPostprocessing = 0; 269 | }; 270 | A33788A21C48DEEF001B467E /* Sources */ = { 271 | isa = PBXSourcesBuildPhase; 272 | buildActionMask = 2147483647; 273 | files = ( 274 | A33788B01C48DEEF001B467E /* ViewController.m in Sources */, 275 | A33788AD1C48DEEF001B467E /* AppDelegate.m in Sources */, 276 | A33788AA1C48DEEF001B467E /* main.m in Sources */, 277 | ); 278 | runOnlyForDeploymentPostprocessing = 0; 279 | }; 280 | /* End PBXSourcesBuildPhase section */ 281 | 282 | /* Begin PBXTargetDependency section */ 283 | A33788C41C48E237001B467E /* PBXTargetDependency */ = { 284 | isa = PBXTargetDependency; 285 | target = A33788991C48DEAF001B467E /* KKPagedFlowView */; 286 | targetProxy = A33788C31C48E237001B467E /* PBXContainerItemProxy */; 287 | }; 288 | /* End PBXTargetDependency section */ 289 | 290 | /* Begin PBXVariantGroup section */ 291 | A33788B11C48DEEF001B467E /* Main.storyboard */ = { 292 | isa = PBXVariantGroup; 293 | children = ( 294 | A33788B21C48DEEF001B467E /* Base */, 295 | ); 296 | name = Main.storyboard; 297 | sourceTree = ""; 298 | }; 299 | A33788B61C48DEEF001B467E /* LaunchScreen.storyboard */ = { 300 | isa = PBXVariantGroup; 301 | children = ( 302 | A33788B71C48DEEF001B467E /* Base */, 303 | ); 304 | name = LaunchScreen.storyboard; 305 | sourceTree = ""; 306 | }; 307 | /* End PBXVariantGroup section */ 308 | 309 | /* Begin XCBuildConfiguration section */ 310 | A33788A01C48DEAF001B467E /* Debug */ = { 311 | isa = XCBuildConfiguration; 312 | buildSettings = { 313 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 314 | CLANG_CXX_LIBRARY = "libc++"; 315 | CLANG_ENABLE_MODULES = YES; 316 | CLANG_ENABLE_OBJC_ARC = YES; 317 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 318 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 319 | CURRENT_PROJECT_VERSION = 1; 320 | DEBUG_INFORMATION_FORMAT = dwarf; 321 | DEFINES_MODULE = YES; 322 | DYLIB_COMPATIBILITY_VERSION = 1; 323 | DYLIB_CURRENT_VERSION = 1; 324 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 325 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 326 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 327 | INFOPLIST_FILE = KKPagedFlowView/Info.plist; 328 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 329 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 330 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 331 | MTL_ENABLE_DEBUG_INFO = YES; 332 | PRODUCT_BUNDLE_IDENTIFIER = com.geeklu.KKPagedFlowView; 333 | PRODUCT_NAME = "$(TARGET_NAME)"; 334 | SKIP_INSTALL = YES; 335 | TARGETED_DEVICE_FAMILY = "1,2"; 336 | VERSIONING_SYSTEM = "apple-generic"; 337 | VERSION_INFO_PREFIX = ""; 338 | }; 339 | name = Debug; 340 | }; 341 | A33788A11C48DEAF001B467E /* Release */ = { 342 | isa = XCBuildConfiguration; 343 | buildSettings = { 344 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 345 | CLANG_CXX_LIBRARY = "libc++"; 346 | CLANG_ENABLE_MODULES = YES; 347 | CLANG_ENABLE_OBJC_ARC = YES; 348 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 349 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 350 | COPY_PHASE_STRIP = NO; 351 | CURRENT_PROJECT_VERSION = 1; 352 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 353 | DEFINES_MODULE = YES; 354 | DYLIB_COMPATIBILITY_VERSION = 1; 355 | DYLIB_CURRENT_VERSION = 1; 356 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 357 | ENABLE_NS_ASSERTIONS = NO; 358 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 359 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 360 | INFOPLIST_FILE = KKPagedFlowView/Info.plist; 361 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 362 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 363 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 364 | MTL_ENABLE_DEBUG_INFO = NO; 365 | PRODUCT_BUNDLE_IDENTIFIER = com.geeklu.KKPagedFlowView; 366 | PRODUCT_NAME = "$(TARGET_NAME)"; 367 | SKIP_INSTALL = YES; 368 | TARGETED_DEVICE_FAMILY = "1,2"; 369 | VERSIONING_SYSTEM = "apple-generic"; 370 | VERSION_INFO_PREFIX = ""; 371 | }; 372 | name = Release; 373 | }; 374 | A33788BB1C48DEEF001B467E /* Debug */ = { 375 | isa = XCBuildConfiguration; 376 | buildSettings = { 377 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 378 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 379 | CLANG_CXX_LIBRARY = "libc++"; 380 | CLANG_ENABLE_MODULES = YES; 381 | CLANG_ENABLE_OBJC_ARC = YES; 382 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 383 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 384 | DEBUG_INFORMATION_FORMAT = dwarf; 385 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 386 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 387 | INFOPLIST_FILE = KKPagedFlowViewDemo/Info.plist; 388 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 389 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 390 | MTL_ENABLE_DEBUG_INFO = YES; 391 | PRODUCT_BUNDLE_IDENTIFIER = com.geeklu.KKPagedFlowViewDemo; 392 | PRODUCT_NAME = "$(TARGET_NAME)"; 393 | }; 394 | name = Debug; 395 | }; 396 | A33788BC1C48DEEF001B467E /* Release */ = { 397 | isa = XCBuildConfiguration; 398 | buildSettings = { 399 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 400 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 401 | CLANG_CXX_LIBRARY = "libc++"; 402 | CLANG_ENABLE_MODULES = YES; 403 | CLANG_ENABLE_OBJC_ARC = YES; 404 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 405 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 406 | COPY_PHASE_STRIP = NO; 407 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 408 | ENABLE_NS_ASSERTIONS = NO; 409 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 410 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 411 | INFOPLIST_FILE = KKPagedFlowViewDemo/Info.plist; 412 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 413 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 414 | MTL_ENABLE_DEBUG_INFO = NO; 415 | PRODUCT_BUNDLE_IDENTIFIER = com.geeklu.KKPagedFlowViewDemo; 416 | PRODUCT_NAME = "$(TARGET_NAME)"; 417 | }; 418 | name = Release; 419 | }; 420 | A3FB09251504D92600EE9194 /* Debug */ = { 421 | isa = XCBuildConfiguration; 422 | buildSettings = { 423 | ALWAYS_SEARCH_USER_PATHS = NO; 424 | CLANG_WARN_BOOL_CONVERSION = YES; 425 | CLANG_WARN_CONSTANT_CONVERSION = YES; 426 | CLANG_WARN_EMPTY_BODY = YES; 427 | CLANG_WARN_ENUM_CONVERSION = YES; 428 | CLANG_WARN_INT_CONVERSION = YES; 429 | CLANG_WARN_UNREACHABLE_CODE = YES; 430 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 431 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 432 | COPY_PHASE_STRIP = NO; 433 | ENABLE_STRICT_OBJC_MSGSEND = YES; 434 | ENABLE_TESTABILITY = YES; 435 | GCC_C_LANGUAGE_STANDARD = gnu99; 436 | GCC_DYNAMIC_NO_PIC = NO; 437 | GCC_NO_COMMON_BLOCKS = YES; 438 | GCC_OPTIMIZATION_LEVEL = 0; 439 | GCC_PREPROCESSOR_DEFINITIONS = ( 440 | "DEBUG=1", 441 | "$(inherited)", 442 | ); 443 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 444 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 445 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 446 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 447 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 448 | GCC_WARN_UNDECLARED_SELECTOR = YES; 449 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 450 | GCC_WARN_UNUSED_FUNCTION = YES; 451 | GCC_WARN_UNUSED_VARIABLE = YES; 452 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 453 | ONLY_ACTIVE_ARCH = YES; 454 | SDKROOT = iphoneos; 455 | }; 456 | name = Debug; 457 | }; 458 | A3FB09261504D92600EE9194 /* Release */ = { 459 | isa = XCBuildConfiguration; 460 | buildSettings = { 461 | ALWAYS_SEARCH_USER_PATHS = NO; 462 | CLANG_WARN_BOOL_CONVERSION = YES; 463 | CLANG_WARN_CONSTANT_CONVERSION = YES; 464 | CLANG_WARN_EMPTY_BODY = YES; 465 | CLANG_WARN_ENUM_CONVERSION = YES; 466 | CLANG_WARN_INT_CONVERSION = YES; 467 | CLANG_WARN_UNREACHABLE_CODE = YES; 468 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 469 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 470 | COPY_PHASE_STRIP = YES; 471 | ENABLE_STRICT_OBJC_MSGSEND = YES; 472 | GCC_C_LANGUAGE_STANDARD = gnu99; 473 | GCC_NO_COMMON_BLOCKS = YES; 474 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 475 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 476 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 477 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 478 | GCC_WARN_UNDECLARED_SELECTOR = YES; 479 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 480 | GCC_WARN_UNUSED_FUNCTION = YES; 481 | GCC_WARN_UNUSED_VARIABLE = YES; 482 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 483 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 484 | SDKROOT = iphoneos; 485 | VALIDATE_PRODUCT = YES; 486 | }; 487 | name = Release; 488 | }; 489 | /* End XCBuildConfiguration section */ 490 | 491 | /* Begin XCConfigurationList section */ 492 | A337889F1C48DEAF001B467E /* Build configuration list for PBXNativeTarget "KKPagedFlowView" */ = { 493 | isa = XCConfigurationList; 494 | buildConfigurations = ( 495 | A33788A01C48DEAF001B467E /* Debug */, 496 | A33788A11C48DEAF001B467E /* Release */, 497 | ); 498 | defaultConfigurationIsVisible = 0; 499 | }; 500 | A33788BA1C48DEEF001B467E /* Build configuration list for PBXNativeTarget "KKPagedFlowViewDemo" */ = { 501 | isa = XCConfigurationList; 502 | buildConfigurations = ( 503 | A33788BB1C48DEEF001B467E /* Debug */, 504 | A33788BC1C48DEEF001B467E /* Release */, 505 | ); 506 | defaultConfigurationIsVisible = 0; 507 | }; 508 | A3FB09031504D92500EE9194 /* Build configuration list for PBXProject "KKPagedFlowView" */ = { 509 | isa = XCConfigurationList; 510 | buildConfigurations = ( 511 | A3FB09251504D92600EE9194 /* Debug */, 512 | A3FB09261504D92600EE9194 /* Release */, 513 | ); 514 | defaultConfigurationIsVisible = 0; 515 | defaultConfigurationName = Release; 516 | }; 517 | /* End XCConfigurationList section */ 518 | }; 519 | rootObject = A3FB09001504D92500EE9194 /* Project object */; 520 | } 521 | -------------------------------------------------------------------------------- /KKPagedFlowView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /KKPagedFlowView/KKPagedFlowView.h: -------------------------------------------------------------------------------- 1 | // 2 | // KKPagedFlowView.h 3 | // KKPagedFlowView 4 | // 5 | // Created by Luke on 1/15/16. 6 | // Copyright © 2016 Taobao.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for KKPagedFlowView. 12 | FOUNDATION_EXPORT double KKPagedFlowViewVersionNumber; 13 | 14 | //! Project version string for KKPagedFlowView. 15 | FOUNDATION_EXPORT const unsigned char KKPagedFlowViewVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | #if __has_include() 20 | 21 | #import 22 | 23 | #else 24 | 25 | #import "PagedFlowView.h" 26 | 27 | #endif 28 | 29 | 30 | -------------------------------------------------------------------------------- /KKPagedFlowView/PagedFlowView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PagedFlowView.h 3 | // taobao4iphone 4 | // 5 | // Created by Lu Kejin on 3/2/12. 6 | // Copyright (c) 2012 geeklu.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol PagedFlowViewDataSource; 12 | @protocol PagedFlowViewDelegate; 13 | 14 | typedef enum{ 15 | PagedFlowViewOrientationHorizontal = 0, 16 | PagedFlowViewOrientationVertical 17 | }PagedFlowViewOrientation; 18 | 19 | @interface PagedFlowView : UIView 20 | @property(nonatomic,strong) UIPageControl *pageControl; 21 | @property(nonatomic, assign) CGFloat minimumPageAlpha; 22 | @property(nonatomic, assign) CGFloat minimumPageScale; 23 | @property(nonatomic, assign) PagedFlowViewOrientation orientation; 24 | @property(nonatomic, assign, readonly) NSInteger currentPageIndex; 25 | 26 | @property(nonatomic,weak) id dataSource; 27 | @property(nonatomic,weak) id delegate; 28 | 29 | - (void)reloadData; 30 | - (UIView *)dequeueReusableCell; // 获取可重复使用的Cell 31 | - (void)scrollToPage:(NSUInteger)pageNumber; 32 | 33 | @end 34 | 35 | 36 | @protocol PagedFlowViewDelegate 37 | 38 | - (CGSize)sizeForPageInFlowView:(PagedFlowView *)flowView; 39 | 40 | @optional 41 | - (void)flowView:(PagedFlowView *)flowView didScrollToPageAtIndex:(NSInteger)index; 42 | - (void)flowView:(PagedFlowView *)flowView didTapPageAtIndex:(NSInteger)index; 43 | 44 | @end 45 | 46 | 47 | @protocol PagedFlowViewDataSource 48 | 49 | - (NSInteger)numberOfPagesInFlowView:(PagedFlowView *)flowView; 50 | - (UIView *)flowView:(PagedFlowView *)flowView cellForPageAtIndex:(NSInteger)index; 51 | 52 | @end -------------------------------------------------------------------------------- /KKPagedFlowView/PagedFlowView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PagedFlowView.m 3 | // taobao4iphone 4 | // 5 | // Created by Lu Kejin on 3/2/12. 6 | // Copyright (c) 2012 geeklu.com. All rights reserved. 7 | // 8 | 9 | #import "PagedFlowView.h" 10 | #import 11 | 12 | @interface PagedFlowView () 13 | 14 | @property (nonatomic, assign, readwrite) NSInteger currentPageIndex; 15 | @property(nonatomic, strong) UIScrollView *scrollView; 16 | @property(nonatomic, assign) BOOL needsReload; 17 | @property(nonatomic, assign) CGSize pageSize; 18 | @property(nonatomic, assign) NSUInteger pageCount; 19 | @property(nonatomic, strong) NSMutableArray *cells; 20 | @property(nonatomic, assign) NSRange visibleRange; 21 | @property(nonatomic, strong) NSMutableArray *reusableCells; 22 | 23 | @end 24 | 25 | @implementation PagedFlowView 26 | @synthesize orientation; 27 | 28 | //////////////////////////////////////////////////////////////////////////////////////////////////// 29 | #pragma mark - 30 | #pragma mark Private Methods 31 | -(void)handleTapGesture:(UIGestureRecognizer*)gestureRecognizer{ 32 | NSInteger tappedIndex = 0; 33 | CGPoint locationInScrollView = [gestureRecognizer locationInView:_scrollView]; 34 | if (CGRectContainsPoint(_scrollView.bounds, locationInScrollView)) { 35 | tappedIndex = _currentPageIndex; 36 | if ([self.delegate respondsToSelector:@selector(flowView:didTapPageAtIndex:)]) { 37 | [self.delegate flowView:self didTapPageAtIndex:tappedIndex]; 38 | } 39 | } 40 | } 41 | 42 | - (void)initialize{ 43 | self.clipsToBounds = YES; 44 | 45 | UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)]; 46 | [self addGestureRecognizer:tapRecognizer]; 47 | 48 | _needsReload = YES; 49 | _pageSize = self.bounds.size; 50 | _pageCount = 0; 51 | _currentPageIndex = 0; 52 | 53 | _minimumPageAlpha = 1.0; 54 | _minimumPageScale = 1.0; 55 | 56 | _visibleRange = NSMakeRange(0, 0); 57 | 58 | _reusableCells = [[NSMutableArray alloc] initWithCapacity:0]; 59 | _cells = [[NSMutableArray alloc] initWithCapacity:0]; 60 | 61 | _scrollView = [[UIScrollView alloc] initWithFrame:self.bounds]; 62 | _scrollView.delegate = self; 63 | _scrollView.pagingEnabled = YES; 64 | _scrollView.clipsToBounds = NO; 65 | _scrollView.showsHorizontalScrollIndicator = NO; 66 | _scrollView.showsVerticalScrollIndicator = NO; 67 | 68 | /*由于UIScrollView在滚动之后会调用自己的layoutSubviews以及父View的layoutSubviews 69 | 这里为了避免scrollview滚动带来自己layoutSubviews的调用,所以给scrollView加了一层父View 70 | */ 71 | UIView *superViewOfScrollView = [[UIView alloc] initWithFrame:self.bounds]; 72 | [superViewOfScrollView setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight]; 73 | [superViewOfScrollView setBackgroundColor:[UIColor clearColor]]; 74 | [superViewOfScrollView addSubview:_scrollView]; 75 | [self addSubview:superViewOfScrollView]; 76 | 77 | } 78 | 79 | 80 | - (void)dealloc{ 81 | _scrollView.delegate = nil; 82 | } 83 | 84 | - (void)queueReusableCell:(UIView *)cell{ 85 | [_reusableCells addObject:cell]; 86 | } 87 | 88 | - (void)removeCellAtIndex:(NSInteger)index{ 89 | UIView *cell = [_cells objectAtIndex:index]; 90 | if ((NSObject *)cell == [NSNull null]) { 91 | return; 92 | } 93 | 94 | [self queueReusableCell:cell]; 95 | 96 | if (cell.superview) { 97 | cell.layer.transform = CATransform3DIdentity; 98 | [cell removeFromSuperview]; 99 | } 100 | 101 | [_cells replaceObjectAtIndex:index withObject:[NSNull null]]; 102 | } 103 | 104 | - (void)refreshVisibleCellAppearance{ 105 | 106 | if (_minimumPageAlpha == 1.0 && _minimumPageScale == 1.0) { 107 | return;//无需更新 108 | } 109 | switch (orientation) { 110 | case PagedFlowViewOrientationHorizontal:{ 111 | CGFloat offset = _scrollView.contentOffset.x; 112 | 113 | for (NSUInteger i = _visibleRange.location; i < _visibleRange.location + _visibleRange.length; i++) { 114 | UIView *cell = [_cells objectAtIndex:i]; 115 | CGFloat origin = cell.frame.origin.x; 116 | CGFloat delta = fabs(origin - offset); 117 | 118 | [UIView beginAnimations:@"CellAnimation" context:nil]; 119 | if (delta < _pageSize.width) { 120 | cell.alpha = 1 - (delta / _pageSize.width) * (1 - _minimumPageAlpha); 121 | 122 | CGFloat pageScale = 1 - (delta / _pageSize.width) * (1 - _minimumPageScale); 123 | cell.layer.transform = CATransform3DMakeScale(pageScale, pageScale, 1); 124 | } else { 125 | cell.alpha = _minimumPageAlpha; 126 | cell.layer.transform = CATransform3DMakeScale(_minimumPageScale, _minimumPageScale, 1); 127 | } 128 | [UIView commitAnimations]; 129 | } 130 | break; 131 | } 132 | case PagedFlowViewOrientationVertical:{ 133 | CGFloat offset = _scrollView.contentOffset.y; 134 | 135 | for (NSUInteger i = _visibleRange.location; i < _visibleRange.location + _visibleRange.length; i++) { 136 | UIView *cell = [_cells objectAtIndex:i]; 137 | CGFloat origin = cell.frame.origin.y; 138 | CGFloat delta = fabs(origin - offset); 139 | 140 | [UIView beginAnimations:@"CellAnimation" context:nil]; 141 | if (delta < _pageSize.height) { 142 | cell.alpha = 1 - (delta / _pageSize.height) * (1 - _minimumPageAlpha); 143 | 144 | CGFloat pageScale = 1 - (delta / _pageSize.height) * (1 - _minimumPageScale); 145 | cell.layer.transform = CATransform3DMakeScale(pageScale, pageScale, 1); 146 | } else { 147 | cell.alpha = _minimumPageAlpha; 148 | cell.layer.transform = CATransform3DMakeScale(_minimumPageScale, _minimumPageScale, 1); 149 | } 150 | [UIView commitAnimations]; 151 | } 152 | } 153 | default: 154 | break; 155 | } 156 | 157 | } 158 | 159 | - (void)setPageAtIndex:(NSInteger)pageIndex{ 160 | NSParameterAssert(pageIndex >= 0 && pageIndex < [_cells count]); 161 | 162 | UIView *cell = [_cells objectAtIndex:pageIndex]; 163 | 164 | if ((NSObject *)cell == [NSNull null]) { 165 | cell = [_dataSource flowView:self cellForPageAtIndex:pageIndex]; 166 | NSAssert(cell!=nil, @"datasource must not return nil"); 167 | [_cells replaceObjectAtIndex:pageIndex withObject:cell]; 168 | 169 | 170 | switch (orientation) { 171 | case PagedFlowViewOrientationHorizontal: 172 | cell.frame = CGRectMake(_pageSize.width * pageIndex, 0, _pageSize.width, _pageSize.height); 173 | break; 174 | case PagedFlowViewOrientationVertical: 175 | cell.frame = CGRectMake(0, _pageSize.height * pageIndex, _pageSize.width, _pageSize.height); 176 | break; 177 | default: 178 | break; 179 | } 180 | 181 | if (!cell.superview) { 182 | [_scrollView addSubview:cell]; 183 | } 184 | } 185 | } 186 | 187 | 188 | - (void)setPagesAtContentOffset:(CGPoint)offset{ 189 | 190 | NSUInteger cellCount = [self.cells count]; 191 | 192 | if (cellCount == 0) return; 193 | 194 | // scrollView的大小是由pageSize决定的,然后放置于PagedFlowView的正中心 195 | CGPoint startPoint = CGPointMake(offset.x - CGRectGetMinX(_scrollView.frame), offset.y - CGRectGetMinY(_scrollView.frame)); 196 | CGPoint endPoint = CGPointMake(startPoint.x + CGRectGetWidth(self.bounds), startPoint.y + CGRectGetHeight(self.bounds)); 197 | 198 | 199 | switch (orientation) { 200 | case PagedFlowViewOrientationHorizontal:{ 201 | NSUInteger startIndex = 0; 202 | if (startPoint.x > 0) { 203 | startIndex = floor(startPoint.x / self.pageSize.width); 204 | } 205 | 206 | NSInteger endIndex = ceil(endPoint.x / self.pageSize.width); 207 | if (endIndex > cellCount - 1) { 208 | endIndex = cellCount - 1; 209 | } 210 | 211 | //可见页分别向前向后扩展一个,提高效率 212 | if (startIndex > 0) { 213 | startIndex -= 1; 214 | } 215 | if (endIndex < cellCount - 1) { 216 | endIndex += 1; 217 | } 218 | 219 | if (_visibleRange.location == startIndex && 220 | _visibleRange.length == (endIndex - startIndex + 1)) { 221 | return; 222 | } 223 | 224 | _visibleRange.location = startIndex; 225 | _visibleRange.length = endIndex - startIndex + 1; 226 | 227 | for (NSUInteger i = startIndex; i <= endIndex; i++) { 228 | [self setPageAtIndex:i]; 229 | } 230 | 231 | for (int i = 0; i < startIndex; i ++) { 232 | [self removeCellAtIndex:i]; 233 | } 234 | 235 | for (NSUInteger i = endIndex + 1; i < [_cells count]; i ++) { 236 | [self removeCellAtIndex:i]; 237 | } 238 | break; 239 | } 240 | case PagedFlowViewOrientationVertical:{ 241 | NSInteger startIndex = 0; 242 | NSUInteger cellCount = [self.cells count]; 243 | if (startPoint.y > 0) { 244 | startIndex = floor(startPoint.y / self.pageSize.height); 245 | } 246 | 247 | NSInteger endIndex = ceil(endPoint.y / self.pageSize.height); 248 | if (endIndex > cellCount - 1) { 249 | endIndex = cellCount - 1; 250 | } 251 | 252 | //可见页分别向前向后扩展一个,提高效率 253 | if (startIndex > 0) { 254 | startIndex -= 1; 255 | } 256 | 257 | if (endIndex < cellCount - 1) { 258 | endIndex += 1; 259 | } 260 | 261 | if (_visibleRange.location == startIndex && 262 | _visibleRange.length == (endIndex - startIndex + 1)) { 263 | return; 264 | } 265 | 266 | _visibleRange.location = startIndex; 267 | _visibleRange.length = endIndex - startIndex + 1; 268 | 269 | for (NSUInteger i = startIndex; i <= endIndex; i++) { 270 | [self setPageAtIndex:i]; 271 | } 272 | 273 | for (int i = 0; i < startIndex; i ++) { 274 | [self removeCellAtIndex:i]; 275 | } 276 | 277 | for (NSUInteger i = endIndex + 1; i < [_cells count]; i ++) { 278 | [self removeCellAtIndex:i]; 279 | } 280 | break; 281 | } 282 | default: 283 | break; 284 | } 285 | 286 | 287 | 288 | } 289 | 290 | 291 | 292 | 293 | //////////////////////////////////////////////////////////////////////////////////////////////////// 294 | #pragma mark - 295 | #pragma mark Override Methods 296 | 297 | - (id)initWithFrame:(CGRect)frame 298 | { 299 | self = [super initWithFrame:frame]; 300 | if (self) 301 | { 302 | [self initialize]; 303 | } 304 | return self; 305 | } 306 | 307 | - (id)initWithCoder:(NSCoder *)aDecoder 308 | { 309 | self = [super initWithCoder:aDecoder]; 310 | if (self) 311 | { 312 | [self initialize]; 313 | } 314 | return self; 315 | } 316 | 317 | - (void)layoutSubviews{ 318 | [super layoutSubviews]; 319 | 320 | if (_needsReload) { 321 | //如果需要重新加载数据,则需要清空相关数据全部重新加载 322 | 323 | 324 | //重置pageCount 325 | if (_dataSource && [_dataSource respondsToSelector:@selector(numberOfPagesInFlowView:)]) { 326 | _pageCount = [_dataSource numberOfPagesInFlowView:self]; 327 | 328 | if (self.pageControl && [self.pageControl respondsToSelector:@selector(setNumberOfPages:)]) { 329 | [self.pageControl setNumberOfPages:_pageCount]; 330 | } 331 | } 332 | 333 | //重置pageWidth 334 | if (_delegate && [_delegate respondsToSelector:@selector(sizeForPageInFlowView:)]) { 335 | _pageSize = [_delegate sizeForPageInFlowView:self]; 336 | } 337 | 338 | [_reusableCells removeAllObjects]; 339 | _visibleRange = NSMakeRange(0, 0); 340 | 341 | //从supperView上移除cell 342 | for (NSInteger i=0; i<[_cells count]; i++) { 343 | [self removeCellAtIndex:i]; 344 | } 345 | 346 | //填充cells数组 347 | [_cells removeAllObjects]; 348 | for (NSInteger index=0; index<_pageCount; index++) 349 | { 350 | [_cells addObject:[NSNull null]]; 351 | } 352 | 353 | // 重置_scrollView的contentSize 354 | switch (orientation) { 355 | case PagedFlowViewOrientationHorizontal://横向 356 | _scrollView.frame = CGRectMake(0, 0, _pageSize.width, _pageSize.height); 357 | _scrollView.contentSize = CGSizeMake(_pageSize.width * _pageCount,_pageSize.height); 358 | CGPoint theCenter = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)); 359 | _scrollView.center = theCenter; 360 | break; 361 | case PagedFlowViewOrientationVertical:{ 362 | _scrollView.frame = CGRectMake(0, 0, _pageSize.width, _pageSize.height); 363 | _scrollView.contentSize = CGSizeMake(_pageSize.width ,_pageSize.height * _pageCount); 364 | CGPoint theCenter = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)); 365 | _scrollView.center = theCenter; 366 | break; 367 | } 368 | default: 369 | break; 370 | } 371 | } 372 | 373 | 374 | [self setPagesAtContentOffset:_scrollView.contentOffset];//根据当前scrollView的offset设置cell 375 | 376 | [self refreshVisibleCellAppearance];//更新各个可见Cell的显示外貌 377 | 378 | } 379 | 380 | //////////////////////////////////////////////////////////////////////////////////////////////////// 381 | #pragma mark - 382 | #pragma mark PagedFlowView API 383 | 384 | - (void)reloadData 385 | { 386 | _needsReload = YES; 387 | 388 | [self setNeedsLayout]; 389 | } 390 | 391 | 392 | - (UIView *)dequeueReusableCell{ 393 | UIView *cell = [_reusableCells lastObject]; 394 | if (cell) 395 | { 396 | [_reusableCells removeLastObject]; 397 | } 398 | 399 | return cell; 400 | } 401 | 402 | - (void)scrollToPage:(NSUInteger)pageNumber { 403 | if (pageNumber < _pageCount) { 404 | switch (orientation) { 405 | case PagedFlowViewOrientationHorizontal: 406 | [_scrollView setContentOffset:CGPointMake(_pageSize.width * pageNumber, 0) animated:YES]; 407 | break; 408 | case PagedFlowViewOrientationVertical: 409 | [_scrollView setContentOffset:CGPointMake(0, _pageSize.height * pageNumber) animated:YES]; 410 | break; 411 | } 412 | [self setPagesAtContentOffset:_scrollView.contentOffset]; 413 | [self refreshVisibleCellAppearance]; 414 | } 415 | } 416 | 417 | //////////////////////////////////////////////////////////////////////////////////////////////////// 418 | #pragma mark - 419 | #pragma mark hitTest 420 | 421 | - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { 422 | if ([self pointInside:point withEvent:event]) { 423 | CGPoint newPoint = CGPointZero; 424 | newPoint.x = point.x - _scrollView.frame.origin.x + _scrollView.contentOffset.x; 425 | newPoint.y = point.y - _scrollView.frame.origin.y + _scrollView.contentOffset.y; 426 | if ([_scrollView pointInside:newPoint withEvent:event]) { 427 | return [_scrollView hitTest:newPoint withEvent:event]; 428 | } 429 | 430 | return _scrollView; 431 | } 432 | 433 | return nil; 434 | } 435 | 436 | 437 | //////////////////////////////////////////////////////////////////////////////////////////////////// 438 | #pragma mark - 439 | #pragma mark UIScrollView Delegate 440 | 441 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView{ 442 | [self setPagesAtContentOffset:scrollView.contentOffset]; 443 | [self refreshVisibleCellAppearance]; 444 | } 445 | 446 | 447 | - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{ 448 | //如果有PageControl,计算出当前页码,并对pageControl进行更新 449 | 450 | NSInteger pageIndex; 451 | 452 | switch (orientation) { 453 | case PagedFlowViewOrientationHorizontal: 454 | pageIndex = floor(MAX(_scrollView.contentOffset.x, 0) / _pageSize.width); 455 | break; 456 | case PagedFlowViewOrientationVertical: 457 | pageIndex = floor(MAX(_scrollView.contentOffset.y, 0) / _pageSize.height); 458 | break; 459 | default: 460 | break; 461 | } 462 | 463 | if (self.pageControl && [self.pageControl respondsToSelector:@selector(setCurrentPage:)]) { 464 | [self.pageControl setCurrentPage:pageIndex]; 465 | } 466 | 467 | if ([_delegate respondsToSelector:@selector(flowView:didScrollToPageAtIndex:)] && _currentPageIndex != pageIndex) { 468 | [_delegate flowView:self didScrollToPageAtIndex:pageIndex]; 469 | } 470 | 471 | _currentPageIndex = pageIndex; 472 | } 473 | 474 | @end 475 | -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // KKPagedFlowViewDemo 4 | // 5 | // Created by Luke on 1/15/16. 6 | // Copyright © 2016 Taobao.com. 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 | -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // KKPagedFlowViewDemo 4 | // 5 | // Created by Luke on 1/15/16. 6 | // Copyright © 2016 Taobao.com. 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 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Assets.xcassets/0.imageset/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kejinlu/KKPagedFlowView/17fbec51541bc1ed5a5a75835053e6d61b8fd226/KKPagedFlowViewDemo/Assets.xcassets/0.imageset/0.png -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Assets.xcassets/0.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "0.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Assets.xcassets/1.imageset/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kejinlu/KKPagedFlowView/17fbec51541bc1ed5a5a75835053e6d61b8fd226/KKPagedFlowViewDemo/Assets.xcassets/1.imageset/1.png -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Assets.xcassets/1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "1.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Assets.xcassets/2.imageset/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kejinlu/KKPagedFlowView/17fbec51541bc1ed5a5a75835053e6d61b8fd226/KKPagedFlowViewDemo/Assets.xcassets/2.imageset/2.png -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Assets.xcassets/2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "2.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Assets.xcassets/3.imageset/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kejinlu/KKPagedFlowView/17fbec51541bc1ed5a5a75835053e6d61b8fd226/KKPagedFlowViewDemo/Assets.xcassets/3.imageset/3.png -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Assets.xcassets/3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "3.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Assets.xcassets/4.imageset/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kejinlu/KKPagedFlowView/17fbec51541bc1ed5a5a75835053e6d61b8fd226/KKPagedFlowViewDemo/Assets.xcassets/4.imageset/4.png -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Assets.xcassets/4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "4.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Assets.xcassets/5.imageset/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kejinlu/KKPagedFlowView/17fbec51541bc1ed5a5a75835053e6d61b8fd226/KKPagedFlowViewDemo/Assets.xcassets/5.imageset/5.png -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Assets.xcassets/5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "5.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Assets.xcassets/6.imageset/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kejinlu/KKPagedFlowView/17fbec51541bc1ed5a5a75835053e6d61b8fd226/KKPagedFlowViewDemo/Assets.xcassets/6.imageset/6.png -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Assets.xcassets/6.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "6.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Assets.xcassets/7.imageset/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kejinlu/KKPagedFlowView/17fbec51541bc1ed5a5a75835053e6d61b8fd226/KKPagedFlowViewDemo/Assets.xcassets/7.imageset/7.png -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Assets.xcassets/7.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "7.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Assets.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 | } -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Base.lproj/LaunchScreen.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 | -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/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 | -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 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 | -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // KKPagedFlowViewDemo 4 | // 5 | // Created by Luke on 1/15/16. 6 | // Copyright © 2016 Taobao.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // KKPagedFlowViewDemo 4 | // 5 | // Created by Luke on 1/15/16. 6 | // Copyright © 2016 Taobao.com. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "PagedFlowView.h" 11 | 12 | @interface ViewController () 13 | @property(nonatomic, strong) IBOutlet PagedFlowView *hFlowView; 14 | @property(nonatomic, strong) IBOutlet PagedFlowView *vFlowView; 15 | @property(nonatomic, strong) IBOutlet UIPageControl *hPageControl; 16 | @property(nonatomic, strong) NSArray *imageArray; 17 | @end 18 | 19 | @implementation ViewController 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | 24 | 25 | self.imageArray = [[NSArray alloc] initWithObjects:@"0.tiff",@"1.tiff",@"2.tiff",@"3.tiff",@"4.tiff",@"5.tiff",@"6.tiff",@"7.tiff",nil]; 26 | 27 | self.hFlowView.delegate = self; 28 | self.hFlowView.dataSource = self; 29 | self.hFlowView.pageControl = self.hPageControl; 30 | self.hFlowView.minimumPageAlpha = 0.3; 31 | self.hFlowView.minimumPageScale = 0.9; 32 | 33 | self.vFlowView.delegate = self; 34 | self.vFlowView.dataSource = self; 35 | self.vFlowView.minimumPageAlpha = 0.4; 36 | self.vFlowView.minimumPageScale = 0.8; 37 | self.vFlowView.orientation = PagedFlowViewOrientationVertical; 38 | 39 | } 40 | 41 | - (void)didReceiveMemoryWarning { 42 | [super didReceiveMemoryWarning]; 43 | // Dispose of any resources that can be recreated. 44 | } 45 | 46 | 47 | 48 | //////////////////////////////////////////////////////////////////////////////////////////////////// 49 | #pragma mark - 50 | #pragma mark PagedFlowView Delegate 51 | - (CGSize)sizeForPageInFlowView:(PagedFlowView *)flowView;{ 52 | return CGSizeMake(200, 150); 53 | } 54 | 55 | - (void)flowView:(PagedFlowView *)flowView didScrollToPageAtIndex:(NSInteger)index { 56 | NSLog(@"Scrolled to page # %ld", (long)index); 57 | } 58 | 59 | - (void)flowView:(PagedFlowView *)flowView didTapPageAtIndex:(NSInteger)index{ 60 | NSLog(@"Tapped on page # %ld", (long)index); 61 | } 62 | 63 | //////////////////////////////////////////////////////////////////////////////////////////////////// 64 | #pragma mark - 65 | #pragma mark PagedFlowView Datasource 66 | //返回显示View的个数 67 | - (NSInteger)numberOfPagesInFlowView:(PagedFlowView *)flowView{ 68 | return [self.imageArray count]; 69 | } 70 | 71 | //返回给某列使用的View 72 | - (UIView *)flowView:(PagedFlowView *)flowView cellForPageAtIndex:(NSInteger)index{ 73 | UIImageView *imageView = (UIImageView *)[flowView dequeueReusableCell]; 74 | if (!imageView) { 75 | imageView = [[UIImageView alloc] init]; 76 | imageView.layer.cornerRadius = 6; 77 | imageView.layer.masksToBounds = YES; 78 | } 79 | imageView.image = [UIImage imageNamed:[self.imageArray objectAtIndex:index]]; 80 | return imageView; 81 | } 82 | 83 | - (IBAction)pageControlValueDidChange:(id)sender { 84 | UIPageControl *pageControl = sender; 85 | [self.hFlowView scrollToPage:pageControl.currentPage]; 86 | [self.vFlowView scrollToPage:pageControl.currentPage]; 87 | } 88 | 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /KKPagedFlowViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // KKPagedFlowViewDemo 4 | // 5 | // Created by Luke on 1/15/16. 6 | // Copyright © 2016 Taobao.com. 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### Screenshot 2 | ---- 3 | 4 | ![Demo](http://ww4.sinaimg.cn/large/65cc0af7gw1dqpbq3o6l6j.jpg) 5 | 6 | 7 | ### License 8 | ---- 9 | BSD-style, with the full license available with the in license.txt. -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Luke 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | Neither the name of the geeklu.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 9 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------