├── .gitignore ├── CycleView.podspec ├── CycleView.xcworkspace ├── contents.xcworkspacedata ├── xcshareddata │ └── CycleView.xccheckout └── xcuserdata │ └── sariel.xcuserdatad │ ├── UserInterfaceState.xcuserstate │ └── xcdebugger │ └── Breakpoints_v2.xcbkptlist ├── CycleView ├── CycleView.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ └── sariel.xcuserdatad │ │ └── xcschemes │ │ ├── CycleView.xcscheme │ │ └── xcschememanagement.plist ├── CycleView │ ├── CycleView.h │ └── Info.plist ├── CycleViewTests │ ├── CycleViewTests.swift │ └── Info.plist └── Source │ ├── CycleAnimatorViewController.swift │ └── PictureCycleController.swift ├── CycleViewDemo ├── CycleViewDemo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcuserdata │ │ └── sariel.xcuserdatad │ │ └── xcschemes │ │ ├── CycleViewDemo.xcscheme │ │ └── xcschememanagement.plist ├── CycleViewDemo │ ├── AnimatorViewController.swift │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ ├── 01.imageset │ │ │ ├── 01.png │ │ │ └── Contents.json │ │ ├── 02.imageset │ │ │ ├── 02.png │ │ │ └── Contents.json │ │ ├── 03.imageset │ │ │ ├── 03.png │ │ │ └── Contents.json │ │ ├── 04.imageset │ │ │ ├── 04.png │ │ │ └── Contents.json │ │ ├── 05.imageset │ │ │ ├── 05.png │ │ │ └── Contents.json │ │ ├── 06.imageset │ │ │ ├── 06.png │ │ │ └── Contents.json │ │ ├── 07.imageset │ │ │ ├── 07.png │ │ │ └── Contents.json │ │ ├── 08.imageset │ │ │ ├── 08.png │ │ │ └── Contents.json │ │ ├── 09.imageset │ │ │ ├── 09.png │ │ │ └── Contents.json │ │ ├── 10.imageset │ │ │ ├── 10.png │ │ │ └── Contents.json │ │ ├── 11.imageset │ │ │ ├── 11.png │ │ │ └── Contents.json │ │ ├── 12.imageset │ │ │ ├── 12.png │ │ │ └── Contents.json │ │ ├── 13.imageset │ │ │ ├── 13.png │ │ │ └── Contents.json │ │ ├── 14.imageset │ │ │ ├── 14.png │ │ │ └── Contents.json │ │ ├── 15.imageset │ │ │ ├── 15.png │ │ │ └── Contents.json │ │ ├── 16.imageset │ │ │ ├── 16.png │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── PictureViewController.swift │ └── ViewController.swift └── CycleViewDemoTests │ ├── CycleViewDemoTests.swift │ └── Info.plist ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | # Xcode 3 | # 4 | build/ 5 | *.pbxuser 6 | !default.pbxuser 7 | *.mode1v3 8 | !default.mode1v3 9 | *.mode2v3 10 | !default.mode2v3 11 | *.perspectivev3 12 | !default.perspectivev3 13 | xcuserdata 14 | *.xccheckout 15 | *.moved-aside 16 | DerivedData 17 | *.hmap 18 | *.ipa 19 | *.xcuserstate 20 | 21 | # CocoaPods 22 | # 23 | # We recommend against adding the Pods directory to your .gitignore. However 24 | # you should judge for yourself, the pros and cons are mentioned at: 25 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 26 | # 27 | # Pods/ 28 | 29 | # Carthage 30 | # 31 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 32 | # Carthage/Checkouts 33 | 34 | Carthage/Build 35 | -------------------------------------------------------------------------------- /CycleView.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint CycleView.podspec' to ensure this is a 3 | # valid spec and remove all comments before submitting the spec. 4 | # 5 | # Any lines starting with a # are optional, but encouraged 6 | # 7 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 8 | # 9 | 10 | Pod::Spec.new do |s| 11 | s.name = "CycleView" 12 | s.version = “1.1.0” 13 | s.summary = "The view of an infinite loop.一个无线循环的图片轮播器" 14 | s.description = <<-DESC 15 | An optional longer description of CycleView 16 | 17 | * Markdown format. 18 | * Don't worry about the indent, we strip it! 19 | DESC 20 | s.homepage = "https://github.com/SarielTang/CycleView" 21 | # s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2" 22 | s.license = 'MIT' 23 | s.author = { "SarielTang" => "524896762@qq.com" } 24 | s.source = { :git => "https://github.com/SarielTang/CycleView.git", :tag => s.version.to_s } 25 | # s.social_media_url = 'https://twitter.com/' 26 | 27 | s.platform = :ios, '8.0' 28 | s.requires_arc = true 29 | 30 | s.source_files = 'Pod/CycleView/Source/*.swift' 31 | # s.resource_bundles = { 32 | # 'CycleView' => ['Pod/Assets/*.png'] 33 | # } 34 | 35 | # s.public_header_files = 'Pod/Classes/**/*.h' 36 | # s.frameworks = 'UIKit', 'MapKit' 37 | # s.dependency 'AFNetworking', '~> 2.3' 38 | end 39 | -------------------------------------------------------------------------------- /CycleView.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /CycleView.xcworkspace/xcshareddata/CycleView.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 9D8B752A-75BA-4EEC-BA35-70F8BEA6625F 9 | IDESourceControlProjectName 10 | CycleView 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | D75E0BABFAF9877C9CD33FE326FAB61626F4E937 14 | https://github.com/SarielTang/CycleView.git 15 | 16 | IDESourceControlProjectPath 17 | CycleView.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | D75E0BABFAF9877C9CD33FE326FAB61626F4E937 21 | .. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/SarielTang/CycleView.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | D75E0BABFAF9877C9CD33FE326FAB61626F4E937 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | D75E0BABFAF9877C9CD33FE326FAB61626F4E937 36 | IDESourceControlWCCName 37 | CycleView 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /CycleView.xcworkspace/xcuserdata/sariel.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SarielTang/CycleView/1184a9e0a6e1380dceb3ad5ca9675a1aedf67085/CycleView.xcworkspace/xcuserdata/sariel.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CycleView.xcworkspace/xcuserdata/sariel.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /CycleView/CycleView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 04A47DA11B0A145100CD74C2 /* CycleView.h in Headers */ = {isa = PBXBuildFile; fileRef = 04A47DA01B0A145100CD74C2 /* CycleView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | 04A47DA71B0A145100CD74C2 /* CycleView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04A47D9B1B0A145100CD74C2 /* CycleView.framework */; }; 12 | 04A47DAE1B0A145100CD74C2 /* CycleViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A47DAD1B0A145100CD74C2 /* CycleViewTests.swift */; }; 13 | 765B028A1B149CF1006DD4D5 /* CycleAnimatorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 765B02891B149CF1006DD4D5 /* CycleAnimatorViewController.swift */; }; 14 | 76B2203E1B0CAE35007F667C /* PictureCycleController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76B2203D1B0CAE35007F667C /* PictureCycleController.swift */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXContainerItemProxy section */ 18 | 04A47DA81B0A145100CD74C2 /* PBXContainerItemProxy */ = { 19 | isa = PBXContainerItemProxy; 20 | containerPortal = 04A47D921B0A145100CD74C2 /* Project object */; 21 | proxyType = 1; 22 | remoteGlobalIDString = 04A47D9A1B0A145100CD74C2; 23 | remoteInfo = CycleView; 24 | }; 25 | /* End PBXContainerItemProxy section */ 26 | 27 | /* Begin PBXFileReference section */ 28 | 04A47D9B1B0A145100CD74C2 /* CycleView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CycleView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | 04A47D9F1B0A145100CD74C2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | 04A47DA01B0A145100CD74C2 /* CycleView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CycleView.h; sourceTree = ""; }; 31 | 04A47DA61B0A145100CD74C2 /* CycleViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CycleViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | 04A47DAC1B0A145100CD74C2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | 04A47DAD1B0A145100CD74C2 /* CycleViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CycleViewTests.swift; sourceTree = ""; }; 34 | 765B02891B149CF1006DD4D5 /* CycleAnimatorViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CycleAnimatorViewController.swift; sourceTree = ""; }; 35 | 76B2203D1B0CAE35007F667C /* PictureCycleController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PictureCycleController.swift; sourceTree = ""; }; 36 | /* End PBXFileReference section */ 37 | 38 | /* Begin PBXFrameworksBuildPhase section */ 39 | 04A47D971B0A145100CD74C2 /* Frameworks */ = { 40 | isa = PBXFrameworksBuildPhase; 41 | buildActionMask = 2147483647; 42 | files = ( 43 | ); 44 | runOnlyForDeploymentPostprocessing = 0; 45 | }; 46 | 04A47DA31B0A145100CD74C2 /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | 04A47DA71B0A145100CD74C2 /* CycleView.framework in Frameworks */, 51 | ); 52 | runOnlyForDeploymentPostprocessing = 0; 53 | }; 54 | /* End PBXFrameworksBuildPhase section */ 55 | 56 | /* Begin PBXGroup section */ 57 | 04A47D911B0A145100CD74C2 = { 58 | isa = PBXGroup; 59 | children = ( 60 | 04A47D9D1B0A145100CD74C2 /* CycleView */, 61 | 04A47DAA1B0A145100CD74C2 /* CycleViewTests */, 62 | 04A47D9C1B0A145100CD74C2 /* Products */, 63 | ); 64 | sourceTree = ""; 65 | }; 66 | 04A47D9C1B0A145100CD74C2 /* Products */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 04A47D9B1B0A145100CD74C2 /* CycleView.framework */, 70 | 04A47DA61B0A145100CD74C2 /* CycleViewTests.xctest */, 71 | ); 72 | name = Products; 73 | sourceTree = ""; 74 | }; 75 | 04A47D9D1B0A145100CD74C2 /* CycleView */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 04A47DB71B0A149C00CD74C2 /* Source */, 79 | 04A47DA01B0A145100CD74C2 /* CycleView.h */, 80 | 04A47D9E1B0A145100CD74C2 /* Supporting Files */, 81 | ); 82 | path = CycleView; 83 | sourceTree = ""; 84 | }; 85 | 04A47D9E1B0A145100CD74C2 /* Supporting Files */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 04A47D9F1B0A145100CD74C2 /* Info.plist */, 89 | ); 90 | name = "Supporting Files"; 91 | sourceTree = ""; 92 | }; 93 | 04A47DAA1B0A145100CD74C2 /* CycleViewTests */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 04A47DAD1B0A145100CD74C2 /* CycleViewTests.swift */, 97 | 04A47DAB1B0A145100CD74C2 /* Supporting Files */, 98 | ); 99 | path = CycleViewTests; 100 | sourceTree = ""; 101 | }; 102 | 04A47DAB1B0A145100CD74C2 /* Supporting Files */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 04A47DAC1B0A145100CD74C2 /* Info.plist */, 106 | ); 107 | name = "Supporting Files"; 108 | sourceTree = ""; 109 | }; 110 | 04A47DB71B0A149C00CD74C2 /* Source */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 76B2203D1B0CAE35007F667C /* PictureCycleController.swift */, 114 | 765B02891B149CF1006DD4D5 /* CycleAnimatorViewController.swift */, 115 | ); 116 | path = Source; 117 | sourceTree = SOURCE_ROOT; 118 | }; 119 | /* End PBXGroup section */ 120 | 121 | /* Begin PBXHeadersBuildPhase section */ 122 | 04A47D981B0A145100CD74C2 /* Headers */ = { 123 | isa = PBXHeadersBuildPhase; 124 | buildActionMask = 2147483647; 125 | files = ( 126 | 04A47DA11B0A145100CD74C2 /* CycleView.h in Headers */, 127 | ); 128 | runOnlyForDeploymentPostprocessing = 0; 129 | }; 130 | /* End PBXHeadersBuildPhase section */ 131 | 132 | /* Begin PBXNativeTarget section */ 133 | 04A47D9A1B0A145100CD74C2 /* CycleView */ = { 134 | isa = PBXNativeTarget; 135 | buildConfigurationList = 04A47DB11B0A145100CD74C2 /* Build configuration list for PBXNativeTarget "CycleView" */; 136 | buildPhases = ( 137 | 04A47D961B0A145100CD74C2 /* Sources */, 138 | 04A47D971B0A145100CD74C2 /* Frameworks */, 139 | 04A47D981B0A145100CD74C2 /* Headers */, 140 | 04A47D991B0A145100CD74C2 /* Resources */, 141 | ); 142 | buildRules = ( 143 | ); 144 | dependencies = ( 145 | ); 146 | name = CycleView; 147 | productName = CycleView; 148 | productReference = 04A47D9B1B0A145100CD74C2 /* CycleView.framework */; 149 | productType = "com.apple.product-type.framework"; 150 | }; 151 | 04A47DA51B0A145100CD74C2 /* CycleViewTests */ = { 152 | isa = PBXNativeTarget; 153 | buildConfigurationList = 04A47DB41B0A145100CD74C2 /* Build configuration list for PBXNativeTarget "CycleViewTests" */; 154 | buildPhases = ( 155 | 04A47DA21B0A145100CD74C2 /* Sources */, 156 | 04A47DA31B0A145100CD74C2 /* Frameworks */, 157 | 04A47DA41B0A145100CD74C2 /* Resources */, 158 | ); 159 | buildRules = ( 160 | ); 161 | dependencies = ( 162 | 04A47DA91B0A145100CD74C2 /* PBXTargetDependency */, 163 | ); 164 | name = CycleViewTests; 165 | productName = CycleViewTests; 166 | productReference = 04A47DA61B0A145100CD74C2 /* CycleViewTests.xctest */; 167 | productType = "com.apple.product-type.bundle.unit-test"; 168 | }; 169 | /* End PBXNativeTarget section */ 170 | 171 | /* Begin PBXProject section */ 172 | 04A47D921B0A145100CD74C2 /* Project object */ = { 173 | isa = PBXProject; 174 | attributes = { 175 | LastUpgradeCheck = 0610; 176 | ORGANIZATIONNAME = Sariel; 177 | TargetAttributes = { 178 | 04A47D9A1B0A145100CD74C2 = { 179 | CreatedOnToolsVersion = 6.1.1; 180 | }; 181 | 04A47DA51B0A145100CD74C2 = { 182 | CreatedOnToolsVersion = 6.1.1; 183 | }; 184 | }; 185 | }; 186 | buildConfigurationList = 04A47D951B0A145100CD74C2 /* Build configuration list for PBXProject "CycleView" */; 187 | compatibilityVersion = "Xcode 3.2"; 188 | developmentRegion = English; 189 | hasScannedForEncodings = 0; 190 | knownRegions = ( 191 | en, 192 | ); 193 | mainGroup = 04A47D911B0A145100CD74C2; 194 | productRefGroup = 04A47D9C1B0A145100CD74C2 /* Products */; 195 | projectDirPath = ""; 196 | projectRoot = ""; 197 | targets = ( 198 | 04A47D9A1B0A145100CD74C2 /* CycleView */, 199 | 04A47DA51B0A145100CD74C2 /* CycleViewTests */, 200 | ); 201 | }; 202 | /* End PBXProject section */ 203 | 204 | /* Begin PBXResourcesBuildPhase section */ 205 | 04A47D991B0A145100CD74C2 /* Resources */ = { 206 | isa = PBXResourcesBuildPhase; 207 | buildActionMask = 2147483647; 208 | files = ( 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | 04A47DA41B0A145100CD74C2 /* Resources */ = { 213 | isa = PBXResourcesBuildPhase; 214 | buildActionMask = 2147483647; 215 | files = ( 216 | ); 217 | runOnlyForDeploymentPostprocessing = 0; 218 | }; 219 | /* End PBXResourcesBuildPhase section */ 220 | 221 | /* Begin PBXSourcesBuildPhase section */ 222 | 04A47D961B0A145100CD74C2 /* Sources */ = { 223 | isa = PBXSourcesBuildPhase; 224 | buildActionMask = 2147483647; 225 | files = ( 226 | 765B028A1B149CF1006DD4D5 /* CycleAnimatorViewController.swift in Sources */, 227 | 76B2203E1B0CAE35007F667C /* PictureCycleController.swift in Sources */, 228 | ); 229 | runOnlyForDeploymentPostprocessing = 0; 230 | }; 231 | 04A47DA21B0A145100CD74C2 /* Sources */ = { 232 | isa = PBXSourcesBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | 04A47DAE1B0A145100CD74C2 /* CycleViewTests.swift in Sources */, 236 | ); 237 | runOnlyForDeploymentPostprocessing = 0; 238 | }; 239 | /* End PBXSourcesBuildPhase section */ 240 | 241 | /* Begin PBXTargetDependency section */ 242 | 04A47DA91B0A145100CD74C2 /* PBXTargetDependency */ = { 243 | isa = PBXTargetDependency; 244 | target = 04A47D9A1B0A145100CD74C2 /* CycleView */; 245 | targetProxy = 04A47DA81B0A145100CD74C2 /* PBXContainerItemProxy */; 246 | }; 247 | /* End PBXTargetDependency section */ 248 | 249 | /* Begin XCBuildConfiguration section */ 250 | 04A47DAF1B0A145100CD74C2 /* Debug */ = { 251 | isa = XCBuildConfiguration; 252 | buildSettings = { 253 | ALWAYS_SEARCH_USER_PATHS = NO; 254 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 255 | CLANG_CXX_LIBRARY = "libc++"; 256 | CLANG_ENABLE_MODULES = YES; 257 | CLANG_ENABLE_OBJC_ARC = YES; 258 | CLANG_WARN_BOOL_CONVERSION = YES; 259 | CLANG_WARN_CONSTANT_CONVERSION = YES; 260 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 261 | CLANG_WARN_EMPTY_BODY = YES; 262 | CLANG_WARN_ENUM_CONVERSION = YES; 263 | CLANG_WARN_INT_CONVERSION = YES; 264 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 265 | CLANG_WARN_UNREACHABLE_CODE = YES; 266 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 267 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 268 | COPY_PHASE_STRIP = NO; 269 | CURRENT_PROJECT_VERSION = 1; 270 | ENABLE_STRICT_OBJC_MSGSEND = YES; 271 | GCC_C_LANGUAGE_STANDARD = gnu99; 272 | GCC_DYNAMIC_NO_PIC = NO; 273 | GCC_OPTIMIZATION_LEVEL = 0; 274 | GCC_PREPROCESSOR_DEFINITIONS = ( 275 | "DEBUG=1", 276 | "$(inherited)", 277 | ); 278 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 279 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 280 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 281 | GCC_WARN_UNDECLARED_SELECTOR = YES; 282 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 283 | GCC_WARN_UNUSED_FUNCTION = YES; 284 | GCC_WARN_UNUSED_VARIABLE = YES; 285 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 286 | MTL_ENABLE_DEBUG_INFO = YES; 287 | ONLY_ACTIVE_ARCH = YES; 288 | SDKROOT = iphoneos; 289 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 290 | TARGETED_DEVICE_FAMILY = "1,2"; 291 | VERSIONING_SYSTEM = "apple-generic"; 292 | VERSION_INFO_PREFIX = ""; 293 | }; 294 | name = Debug; 295 | }; 296 | 04A47DB01B0A145100CD74C2 /* Release */ = { 297 | isa = XCBuildConfiguration; 298 | buildSettings = { 299 | ALWAYS_SEARCH_USER_PATHS = NO; 300 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 301 | CLANG_CXX_LIBRARY = "libc++"; 302 | CLANG_ENABLE_MODULES = YES; 303 | CLANG_ENABLE_OBJC_ARC = YES; 304 | CLANG_WARN_BOOL_CONVERSION = YES; 305 | CLANG_WARN_CONSTANT_CONVERSION = YES; 306 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 307 | CLANG_WARN_EMPTY_BODY = YES; 308 | CLANG_WARN_ENUM_CONVERSION = YES; 309 | CLANG_WARN_INT_CONVERSION = YES; 310 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 311 | CLANG_WARN_UNREACHABLE_CODE = YES; 312 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 313 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 314 | COPY_PHASE_STRIP = YES; 315 | CURRENT_PROJECT_VERSION = 1; 316 | ENABLE_NS_ASSERTIONS = NO; 317 | ENABLE_STRICT_OBJC_MSGSEND = YES; 318 | GCC_C_LANGUAGE_STANDARD = gnu99; 319 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 320 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 321 | GCC_WARN_UNDECLARED_SELECTOR = YES; 322 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 323 | GCC_WARN_UNUSED_FUNCTION = YES; 324 | GCC_WARN_UNUSED_VARIABLE = YES; 325 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 326 | MTL_ENABLE_DEBUG_INFO = NO; 327 | SDKROOT = iphoneos; 328 | TARGETED_DEVICE_FAMILY = "1,2"; 329 | VALIDATE_PRODUCT = YES; 330 | VERSIONING_SYSTEM = "apple-generic"; 331 | VERSION_INFO_PREFIX = ""; 332 | }; 333 | name = Release; 334 | }; 335 | 04A47DB21B0A145100CD74C2 /* Debug */ = { 336 | isa = XCBuildConfiguration; 337 | buildSettings = { 338 | DEFINES_MODULE = YES; 339 | DYLIB_COMPATIBILITY_VERSION = 1; 340 | DYLIB_CURRENT_VERSION = 1; 341 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 342 | INFOPLIST_FILE = CycleView/Info.plist; 343 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 344 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 345 | PRODUCT_NAME = "$(TARGET_NAME)"; 346 | SKIP_INSTALL = YES; 347 | }; 348 | name = Debug; 349 | }; 350 | 04A47DB31B0A145100CD74C2 /* Release */ = { 351 | isa = XCBuildConfiguration; 352 | buildSettings = { 353 | DEFINES_MODULE = YES; 354 | DYLIB_COMPATIBILITY_VERSION = 1; 355 | DYLIB_CURRENT_VERSION = 1; 356 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 357 | INFOPLIST_FILE = CycleView/Info.plist; 358 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 359 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 360 | PRODUCT_NAME = "$(TARGET_NAME)"; 361 | SKIP_INSTALL = YES; 362 | }; 363 | name = Release; 364 | }; 365 | 04A47DB51B0A145100CD74C2 /* Debug */ = { 366 | isa = XCBuildConfiguration; 367 | buildSettings = { 368 | FRAMEWORK_SEARCH_PATHS = ( 369 | "$(SDKROOT)/Developer/Library/Frameworks", 370 | "$(inherited)", 371 | ); 372 | GCC_PREPROCESSOR_DEFINITIONS = ( 373 | "DEBUG=1", 374 | "$(inherited)", 375 | ); 376 | INFOPLIST_FILE = CycleViewTests/Info.plist; 377 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 378 | PRODUCT_NAME = "$(TARGET_NAME)"; 379 | }; 380 | name = Debug; 381 | }; 382 | 04A47DB61B0A145100CD74C2 /* Release */ = { 383 | isa = XCBuildConfiguration; 384 | buildSettings = { 385 | FRAMEWORK_SEARCH_PATHS = ( 386 | "$(SDKROOT)/Developer/Library/Frameworks", 387 | "$(inherited)", 388 | ); 389 | INFOPLIST_FILE = CycleViewTests/Info.plist; 390 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 391 | PRODUCT_NAME = "$(TARGET_NAME)"; 392 | }; 393 | name = Release; 394 | }; 395 | /* End XCBuildConfiguration section */ 396 | 397 | /* Begin XCConfigurationList section */ 398 | 04A47D951B0A145100CD74C2 /* Build configuration list for PBXProject "CycleView" */ = { 399 | isa = XCConfigurationList; 400 | buildConfigurations = ( 401 | 04A47DAF1B0A145100CD74C2 /* Debug */, 402 | 04A47DB01B0A145100CD74C2 /* Release */, 403 | ); 404 | defaultConfigurationIsVisible = 0; 405 | defaultConfigurationName = Release; 406 | }; 407 | 04A47DB11B0A145100CD74C2 /* Build configuration list for PBXNativeTarget "CycleView" */ = { 408 | isa = XCConfigurationList; 409 | buildConfigurations = ( 410 | 04A47DB21B0A145100CD74C2 /* Debug */, 411 | 04A47DB31B0A145100CD74C2 /* Release */, 412 | ); 413 | defaultConfigurationIsVisible = 0; 414 | defaultConfigurationName = Release; 415 | }; 416 | 04A47DB41B0A145100CD74C2 /* Build configuration list for PBXNativeTarget "CycleViewTests" */ = { 417 | isa = XCConfigurationList; 418 | buildConfigurations = ( 419 | 04A47DB51B0A145100CD74C2 /* Debug */, 420 | 04A47DB61B0A145100CD74C2 /* Release */, 421 | ); 422 | defaultConfigurationIsVisible = 0; 423 | defaultConfigurationName = Release; 424 | }; 425 | /* End XCConfigurationList section */ 426 | }; 427 | rootObject = 04A47D921B0A145100CD74C2 /* Project object */; 428 | } 429 | -------------------------------------------------------------------------------- /CycleView/CycleView.xcodeproj/xcuserdata/sariel.xcuserdatad/xcschemes/CycleView.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 | -------------------------------------------------------------------------------- /CycleView/CycleView.xcodeproj/xcuserdata/sariel.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CycleView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 04A47D9A1B0A145100CD74C2 16 | 17 | primary 18 | 19 | 20 | 04A47DA51B0A145100CD74C2 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CycleView/CycleView/CycleView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CycleView.h 3 | // CycleView 4 | // 5 | // Created by Sariel's Mac on 15-5-18. 6 | // Copyright (c) 2015年 Sariel. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for CycleView. 12 | FOUNDATION_EXPORT double CycleViewVersionNumber; 13 | 14 | //! Project version string for CycleView. 15 | FOUNDATION_EXPORT const unsigned char CycleViewVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /CycleView/CycleView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | Club.Sariel.$(PRODUCT_NAME:rfc1034identifier) 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 | -------------------------------------------------------------------------------- /CycleView/CycleViewTests/CycleViewTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CycleViewTests.swift 3 | // CycleViewTests 4 | // 5 | // Created by Sariel's Mac on 15-5-18. 6 | // Copyright (c) 2015年 Sariel. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class CycleViewTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /CycleView/CycleViewTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | Club.Sariel.$(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 | -------------------------------------------------------------------------------- /CycleView/Source/CycleAnimatorViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CycleAnimatorViewController.swift 3 | // CycleView 4 | // 5 | // Created by xl_bin on 15/5/26. 6 | // Copyright (c) 2015年 Sariel. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | /* 11 | 12 | 动画类型 说明 对应常量 是否支持方向设置 13 | 公开API 14 | fade 淡出效果 kCATransitionFade 是 15 | movein 新视图移动到旧视图上 kCATransitionMoveIn 是 16 | push 新视图推出旧视图 kCATransitionPush 是 17 | reveal 移开旧视图显示新视图 kCATransitionReveal 是 18 | 私有API 私有API只能通过字符串访问 19 | cube 立方体翻转效果 无 是 20 | oglFlip 翻转效果 无 是 21 | suckEffect 收缩效果 无 否 22 | rippleEffect 水滴波纹效果 无 否 23 | pageCurl 向上翻页效果 无 是 24 | pageUnCurl 向下翻页效果 无 是 25 | cameralIrisHollowOpen 摄像头打开效果 无 否 26 | cameraIrisHollowClose 摄像头关闭效果 无 否 27 | 另外对于支持方向设置的动画类型还包含子类型: 28 | 29 | 动画子类型 说明 30 | kCATransitionFromRight 从右侧转场 31 | kCATransitionFromLeft 从左侧转场 32 | kCATransitionFromTop 从顶部转场 33 | kCATransitionFromBottom 从底部转场 34 | 35 | */ 36 | public enum SRTransitionAnimateType: String { 37 | case FADE = "fade" 38 | case MOVEIN = "movein" 39 | case PUSH = "push" 40 | case REVEAL = "reveal" 41 | case CUBE = "cube" 42 | case OGLFLIP = "oglFlip" 43 | case SUCKEFFECT = "suckEffect" 44 | case RIPPLEEFFECT = "rippleEffect" 45 | case PAGECURL = "pageCurl" 46 | case PAGEUNCURL = "pageUnCurl" 47 | case CAMERALIRISHOLLOWOPEN = "cameralIrisHollowOpen" 48 | case CAMERALIRISHOLLOWCLOSE = "cameraIrisHollowClose" 49 | } 50 | 51 | public class CycleAnimatorViewController: UIViewController { 52 | 53 | var currentIndex: Int? = 0 54 | var AnimatorTimer :NSTimer? 55 | 56 | //公开变量 57 | public var AnimatorImageView:UIImageView? 58 | public var AnimatorImageList = [UIImage]() 59 | public var AnimationType = SRTransitionAnimateType.CUBE.rawValue 60 | 61 | public override func loadView() { 62 | view = UIView(frame: UIScreen.mainScreen().bounds) 63 | AnimatorImageView = UIImageView(frame: self.view.bounds) 64 | view.addSubview(AnimatorImageView!) 65 | AnimatorImageView?.userInteractionEnabled = true 66 | 67 | //设置imageView的约束VFL 68 | var cons = [AnyObject]() 69 | // 70 | cons += NSLayoutConstraint.constraintsWithVisualFormat("H:|-0-[imageView]-0-|", options: NSLayoutFormatOptions(0), metrics: nil, views: ["imageView": AnimatorImageView!]) 71 | cons += NSLayoutConstraint.constraintsWithVisualFormat("V:|-0-[imageView]-0-|", options: NSLayoutFormatOptions(0), metrics: nil, views: ["imageView": AnimatorImageView!]) 72 | view.addConstraints(cons) 73 | } 74 | 75 | override public func viewDidLoad() { 76 | super.viewDidLoad() 77 | 78 | let leftSwiperGesture = UISwipeGestureRecognizer(target: self, action: "leftSwipe:") 79 | leftSwiperGesture.direction = UISwipeGestureRecognizerDirection.Left 80 | view.addGestureRecognizer(leftSwiperGesture) 81 | 82 | let rightSwiperGesture = UISwipeGestureRecognizer(target: self, action: "rightSwipe:") 83 | rightSwiperGesture.direction = UISwipeGestureRecognizerDirection.Right 84 | view.addGestureRecognizer(rightSwiperGesture) 85 | 86 | timeStart() 87 | } 88 | 89 | override public func viewWillAppear(animated: Bool) { 90 | super.viewWillAppear(animated) 91 | AnimatorImageView?.image = AnimatorImageList[currentIndex!] 92 | } 93 | 94 | func leftSwipe(gestuer:UISwipeGestureRecognizer){ 95 | transitionAnimation(true) 96 | } 97 | 98 | func rightSwipe(gestuer:UISwipeGestureRecognizer){ 99 | transitionAnimation(false) 100 | } 101 | 102 | //MARK: - 设置定时器 103 | func timeStart() { 104 | //4 定时器,自动滚动 当时间间隔到达才会执行 105 | let timer = NSTimer(timeInterval: 2, target: self, selector: "nextImage", userInfo: nil, repeats: true) 106 | 107 | AnimatorTimer = timer; 108 | // extern NSString* const NSDefaultRunLoopMode ; 109 | // extern NSString* const NSRunLoopCommonModes; 110 | let runloop = NSRunLoop.currentRunLoop() 111 | runloop.addTimer(timer, forMode: NSRunLoopCommonModes) 112 | } 113 | func nextImage() { 114 | transitionAnimation(true) 115 | } 116 | 117 | public override func touchesBegan(touches: Set, withEvent event: UIEvent) { 118 | println(__FUNCTION__) 119 | AnimatorTimer?.invalidate() 120 | AnimatorTimer = nil 121 | } 122 | public override func touchesCancelled(touches: Set!, withEvent event: UIEvent!) { 123 | println(__FUNCTION__) 124 | let timer = NSTimer(timeInterval: 2, target: self, selector: "nextImage", userInfo: nil, repeats: true) 125 | AnimatorTimer = timer 126 | let runloop = NSRunLoop.currentRunLoop() 127 | runloop.addTimer(timer, forMode: NSRunLoopCommonModes) 128 | } 129 | 130 | 131 | //转场动画 132 | func transitionAnimation(isNext:Bool) { 133 | let transition = CATransition() 134 | transition.type = AnimationType 135 | 136 | //设置子类型 137 | if (isNext) { 138 | transition.subtype=kCATransitionFromRight; 139 | }else{ 140 | transition.subtype=kCATransitionFromLeft; 141 | } 142 | //设置动画时常 143 | transition.duration=1.0; 144 | 145 | //3.设置转场后的新视图添加转场动画 146 | AnimatorImageView!.image = getImage(isNext); 147 | AnimatorImageView!.layer.addAnimation(transition, forKey: "SRTransitionAnimation") 148 | } 149 | 150 | //取得当前图片 151 | func getImage(isNext:Bool) ->(UIImage) { 152 | if (isNext) { 153 | currentIndex = (currentIndex!+1)%AnimatorImageList.count; 154 | }else{ 155 | currentIndex = (currentIndex!-1+AnimatorImageList.count)%AnimatorImageList.count; 156 | } 157 | return AnimatorImageList[currentIndex!] 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /CycleView/Source/PictureCycleController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PictureCycleController.swift 3 | // CycleView 4 | // 5 | // Created by xl_bin on 15/5/20. 6 | // Copyright (c) 2015年 Sariel. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | var PictureCycleCellID = "PictureCycleCellID" 12 | 13 | public class PictureCycleController: UICollectionViewController,UICollectionViewDataSource,UIScrollViewDelegate { 14 | 15 | //当前图片索引 16 | var currentIndex: Int = 0 17 | //记录当前Cell的索引 18 | // var cellIndex: Int = 0 19 | var cycleTimer :NSTimer? 20 | 21 | public var CycleImageList = [UIImage]() 22 | //懒加载collection布局 23 | lazy var layout:UICollectionViewFlowLayout = { 24 | let l = UICollectionViewFlowLayout() 25 | l.itemSize = self.view.bounds.size 26 | l.minimumInteritemSpacing = 0 27 | l.minimumLineSpacing = 0 28 | l.scrollDirection = UICollectionViewScrollDirection.Horizontal 29 | 30 | return l 31 | }() 32 | 33 | // lazy var picCollectionView :UICollectionView = { 34 | // let cv = UICollectionView(frame: self.view.bounds, collectionViewLayout: self.layout) 35 | // 36 | // cv.showsHorizontalScrollIndicator = false 37 | // cv.showsVerticalScrollIndicator = false 38 | // cv.pagingEnabled = true 39 | // //设置collectionView的代理对象 40 | // cv.dataSource = self 41 | // return cv 42 | // }() 43 | 44 | //通过代码加载视图 45 | override public func loadView() { 46 | view = UIView(frame: UIScreen.mainScreen().bounds) 47 | 48 | collectionView = UICollectionView(frame: self.view.bounds, collectionViewLayout: self.layout) 49 | 50 | collectionView!.showsHorizontalScrollIndicator = false 51 | collectionView!.showsVerticalScrollIndicator = false 52 | collectionView!.pagingEnabled = true 53 | //设置collectionView的代理对象 54 | collectionView!.dataSource = self 55 | // view.addSubview(picCollectionView) 56 | } 57 | // //通过sb加载视图 58 | // override func awakeFromNib() { 59 | // super.awakeFromNib() 60 | // 61 | // view.addSubview(collectionView) 62 | // } 63 | 64 | override public func viewDidLoad() { 65 | super.viewDidLoad() 66 | //注册cell 67 | collectionView!.registerClass(PictureCycleCell.self, forCellWithReuseIdentifier: PictureCycleCellID) 68 | timeStart() 69 | } 70 | 71 | public override func viewWillAppear(animated: Bool) { 72 | super.viewWillAppear(animated) 73 | // 开始时就定位到第2页 74 | let indexPath = NSIndexPath(forItem: 1, inSection: 0) 75 | collectionView!.scrollToItemAtIndexPath(indexPath, atScrollPosition: UICollectionViewScrollPosition.CenteredHorizontally, animated: false) 76 | } 77 | 78 | public override func viewDidLayoutSubviews() { 79 | layout.itemSize = self.view.bounds.size 80 | } 81 | 82 | //MARK: - UICollectionView的数据源方法public 83 | public override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 84 | return CycleImageList.count ?? 0 85 | } 86 | 87 | public override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { 88 | let cell = collectionView.dequeueReusableCellWithReuseIdentifier(PictureCycleCellID, forIndexPath: indexPath) as! PictureCycleCell 89 | 90 | //Config Cell... 91 | // cellIndex = indexPath.item 92 | let index = (indexPath.item - 1 + CycleImageList.count + currentIndex) % CycleImageList.count 93 | cell.image = CycleImageList[index] 94 | 95 | return cell 96 | } 97 | 98 | // MARK: - 实现UIScrollView滚动结束后的代理方法 99 | public override func scrollViewDidEndDecelerating(scrollView: UIScrollView) { 100 | 101 | let offset = Int(collectionView!.contentOffset.x / collectionView!.bounds.size.width) - 1 102 | 103 | if offset != 0 { 104 | currentIndex = (currentIndex + CycleImageList.count + offset ) % CycleImageList.count 105 | let indexPath = NSIndexPath(forItem: 1, inSection: 0) 106 | collectionView!.scrollToItemAtIndexPath(indexPath, atScrollPosition: UICollectionViewScrollPosition.CenteredHorizontally, animated: false) 107 | 108 | UIView.setAnimationsEnabled(false) 109 | 110 | self.collectionView!.reloadItemsAtIndexPaths([indexPath]) 111 | 112 | UIView.setAnimationsEnabled(true) 113 | 114 | } 115 | } 116 | 117 | //MARK: - 设置定时器 118 | func timeStart() { 119 | //4 定时器,自动滚动 当时间间隔到达才会执行 120 | let timer = NSTimer(timeInterval: 2, target: self, selector: "nextImage", userInfo: nil, repeats: true) 121 | 122 | cycleTimer = timer; 123 | // extern NSString* const NSDefaultRunLoopMode ; 124 | // extern NSString* const NSRunLoopCommonModes; 125 | let runloop = NSRunLoop.currentRunLoop() 126 | runloop.addTimer(timer, forMode: NSRunLoopCommonModes) 127 | } 128 | func nextImage() { 129 | let indexPath = NSIndexPath(forItem: 2, inSection: 0) 130 | collectionView!.scrollToItemAtIndexPath(indexPath, atScrollPosition: UICollectionViewScrollPosition.CenteredHorizontally, animated: true) 131 | } 132 | 133 | public override func scrollViewWillBeginDragging(scrollView: UIScrollView) { 134 | //开始拖拽,停止定时器 135 | cycleTimer?.invalidate() 136 | cycleTimer = nil 137 | } 138 | 139 | public override func scrollViewDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool) { 140 | let timer = NSTimer(timeInterval: 2, target: self, selector: "nextImage", userInfo: nil, repeats: true) 141 | cycleTimer = timer 142 | let runloop = NSRunLoop.currentRunLoop() 143 | runloop.addTimer(timer, forMode: NSRunLoopCommonModes) 144 | } 145 | 146 | public override func scrollViewDidEndScrollingAnimation(scrollView: UIScrollView) { 147 | let offset = Int(collectionView!.contentOffset.x / collectionView!.bounds.size.width) - 1 148 | 149 | if offset != 0 { 150 | currentIndex = (currentIndex + CycleImageList.count + offset ) % CycleImageList.count 151 | let indexPath = NSIndexPath(forItem: 1, inSection: 0) 152 | collectionView!.scrollToItemAtIndexPath(indexPath, atScrollPosition: UICollectionViewScrollPosition.CenteredHorizontally, animated: false) 153 | 154 | UIView.setAnimationsEnabled(false) 155 | 156 | self.collectionView!.reloadItemsAtIndexPaths([indexPath]) 157 | 158 | UIView.setAnimationsEnabled(true) 159 | 160 | } 161 | } 162 | } 163 | 164 | class PictureCycleCell: UICollectionViewCell { 165 | 166 | var imageView: UIImageView? 167 | 168 | var image: UIImage? { 169 | didSet { 170 | imageView!.image = image 171 | } 172 | } 173 | 174 | override init(frame: CGRect) { 175 | super.init(frame: frame) 176 | imageView = UIImageView() 177 | imageView!.contentMode = UIViewContentMode.ScaleToFill 178 | addSubview(imageView!) 179 | 180 | //设置imageView的约束VFL 181 | imageView?.setTranslatesAutoresizingMaskIntoConstraints(false) 182 | var cons = [AnyObject]() 183 | cons += NSLayoutConstraint.constraintsWithVisualFormat("H:|-0-[imageView]-0-|", options: NSLayoutFormatOptions(0), metrics: nil, views: ["imageView":imageView!]) 184 | cons += NSLayoutConstraint.constraintsWithVisualFormat("V:|-0-[imageView]-0-|", options: NSLayoutFormatOptions(0), metrics: nil, views: ["imageView":imageView!]) 185 | addConstraints(cons) 186 | } 187 | 188 | required init(coder aDecoder: NSCoder) { 189 | super.init(coder: aDecoder) 190 | } 191 | 192 | } 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 04A47D4C1B0A141700CD74C2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A47D4B1B0A141700CD74C2 /* AppDelegate.swift */; }; 11 | 04A47D4E1B0A141700CD74C2 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A47D4D1B0A141700CD74C2 /* ViewController.swift */; }; 12 | 04A47D511B0A141700CD74C2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 04A47D4F1B0A141700CD74C2 /* Main.storyboard */; }; 13 | 04A47D531B0A141700CD74C2 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 04A47D521B0A141700CD74C2 /* Images.xcassets */; }; 14 | 04A47D561B0A141700CD74C2 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 04A47D541B0A141700CD74C2 /* LaunchScreen.xib */; }; 15 | 04A47D621B0A141700CD74C2 /* CycleViewDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A47D611B0A141700CD74C2 /* CycleViewDemoTests.swift */; }; 16 | 7677356B1B154E71005B60C6 /* AnimatorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7677356A1B154E71005B60C6 /* AnimatorViewController.swift */; }; 17 | 76B220401B0CB6A9007F667C /* PictureViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76B2203F1B0CB6A9007F667C /* PictureViewController.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | 04A47D5C1B0A141700CD74C2 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = 04A47D3E1B0A141700CD74C2 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = 04A47D451B0A141700CD74C2; 26 | remoteInfo = CycleViewDemo; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 04A47D461B0A141700CD74C2 /* CycleViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CycleViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | 04A47D4A1B0A141700CD74C2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | 04A47D4B1B0A141700CD74C2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 34 | 04A47D4D1B0A141700CD74C2 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 35 | 04A47D501B0A141700CD74C2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 36 | 04A47D521B0A141700CD74C2 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 37 | 04A47D551B0A141700CD74C2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 38 | 04A47D5B1B0A141700CD74C2 /* CycleViewDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CycleViewDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 04A47D601B0A141700CD74C2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 40 | 04A47D611B0A141700CD74C2 /* CycleViewDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CycleViewDemoTests.swift; sourceTree = ""; }; 41 | 7677356A1B154E71005B60C6 /* AnimatorViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimatorViewController.swift; sourceTree = ""; }; 42 | 76B2203F1B0CB6A9007F667C /* PictureViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PictureViewController.swift; sourceTree = ""; }; 43 | /* End PBXFileReference section */ 44 | 45 | /* Begin PBXFrameworksBuildPhase section */ 46 | 04A47D431B0A141700CD74C2 /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | ); 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | 04A47D581B0A141700CD74C2 /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | /* End PBXFrameworksBuildPhase section */ 61 | 62 | /* Begin PBXGroup section */ 63 | 04A47D3D1B0A141700CD74C2 = { 64 | isa = PBXGroup; 65 | children = ( 66 | 04A47D481B0A141700CD74C2 /* CycleViewDemo */, 67 | 04A47D5E1B0A141700CD74C2 /* CycleViewDemoTests */, 68 | 04A47D471B0A141700CD74C2 /* Products */, 69 | ); 70 | sourceTree = ""; 71 | }; 72 | 04A47D471B0A141700CD74C2 /* Products */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 04A47D461B0A141700CD74C2 /* CycleViewDemo.app */, 76 | 04A47D5B1B0A141700CD74C2 /* CycleViewDemoTests.xctest */, 77 | ); 78 | name = Products; 79 | sourceTree = ""; 80 | }; 81 | 04A47D481B0A141700CD74C2 /* CycleViewDemo */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | 04A47D4B1B0A141700CD74C2 /* AppDelegate.swift */, 85 | 04A47D4D1B0A141700CD74C2 /* ViewController.swift */, 86 | 04A47D4F1B0A141700CD74C2 /* Main.storyboard */, 87 | 7677356A1B154E71005B60C6 /* AnimatorViewController.swift */, 88 | 76B2203F1B0CB6A9007F667C /* PictureViewController.swift */, 89 | 04A47D521B0A141700CD74C2 /* Images.xcassets */, 90 | 04A47D541B0A141700CD74C2 /* LaunchScreen.xib */, 91 | 04A47D491B0A141700CD74C2 /* Supporting Files */, 92 | ); 93 | path = CycleViewDemo; 94 | sourceTree = ""; 95 | }; 96 | 04A47D491B0A141700CD74C2 /* Supporting Files */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 04A47D4A1B0A141700CD74C2 /* Info.plist */, 100 | ); 101 | name = "Supporting Files"; 102 | sourceTree = ""; 103 | }; 104 | 04A47D5E1B0A141700CD74C2 /* CycleViewDemoTests */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 04A47D611B0A141700CD74C2 /* CycleViewDemoTests.swift */, 108 | 04A47D5F1B0A141700CD74C2 /* Supporting Files */, 109 | ); 110 | path = CycleViewDemoTests; 111 | sourceTree = ""; 112 | }; 113 | 04A47D5F1B0A141700CD74C2 /* Supporting Files */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 04A47D601B0A141700CD74C2 /* Info.plist */, 117 | ); 118 | name = "Supporting Files"; 119 | sourceTree = ""; 120 | }; 121 | /* End PBXGroup section */ 122 | 123 | /* Begin PBXNativeTarget section */ 124 | 04A47D451B0A141700CD74C2 /* CycleViewDemo */ = { 125 | isa = PBXNativeTarget; 126 | buildConfigurationList = 04A47D651B0A141700CD74C2 /* Build configuration list for PBXNativeTarget "CycleViewDemo" */; 127 | buildPhases = ( 128 | 04A47D421B0A141700CD74C2 /* Sources */, 129 | 04A47D431B0A141700CD74C2 /* Frameworks */, 130 | 04A47D441B0A141700CD74C2 /* Resources */, 131 | ); 132 | buildRules = ( 133 | ); 134 | dependencies = ( 135 | ); 136 | name = CycleViewDemo; 137 | productName = CycleViewDemo; 138 | productReference = 04A47D461B0A141700CD74C2 /* CycleViewDemo.app */; 139 | productType = "com.apple.product-type.application"; 140 | }; 141 | 04A47D5A1B0A141700CD74C2 /* CycleViewDemoTests */ = { 142 | isa = PBXNativeTarget; 143 | buildConfigurationList = 04A47D681B0A141700CD74C2 /* Build configuration list for PBXNativeTarget "CycleViewDemoTests" */; 144 | buildPhases = ( 145 | 04A47D571B0A141700CD74C2 /* Sources */, 146 | 04A47D581B0A141700CD74C2 /* Frameworks */, 147 | 04A47D591B0A141700CD74C2 /* Resources */, 148 | ); 149 | buildRules = ( 150 | ); 151 | dependencies = ( 152 | 04A47D5D1B0A141700CD74C2 /* PBXTargetDependency */, 153 | ); 154 | name = CycleViewDemoTests; 155 | productName = CycleViewDemoTests; 156 | productReference = 04A47D5B1B0A141700CD74C2 /* CycleViewDemoTests.xctest */; 157 | productType = "com.apple.product-type.bundle.unit-test"; 158 | }; 159 | /* End PBXNativeTarget section */ 160 | 161 | /* Begin PBXProject section */ 162 | 04A47D3E1B0A141700CD74C2 /* Project object */ = { 163 | isa = PBXProject; 164 | attributes = { 165 | LastUpgradeCheck = 0610; 166 | ORGANIZATIONNAME = Sariel; 167 | TargetAttributes = { 168 | 04A47D451B0A141700CD74C2 = { 169 | CreatedOnToolsVersion = 6.1.1; 170 | }; 171 | 04A47D5A1B0A141700CD74C2 = { 172 | CreatedOnToolsVersion = 6.1.1; 173 | TestTargetID = 04A47D451B0A141700CD74C2; 174 | }; 175 | }; 176 | }; 177 | buildConfigurationList = 04A47D411B0A141700CD74C2 /* Build configuration list for PBXProject "CycleViewDemo" */; 178 | compatibilityVersion = "Xcode 3.2"; 179 | developmentRegion = English; 180 | hasScannedForEncodings = 0; 181 | knownRegions = ( 182 | en, 183 | Base, 184 | ); 185 | mainGroup = 04A47D3D1B0A141700CD74C2; 186 | productRefGroup = 04A47D471B0A141700CD74C2 /* Products */; 187 | projectDirPath = ""; 188 | projectRoot = ""; 189 | targets = ( 190 | 04A47D451B0A141700CD74C2 /* CycleViewDemo */, 191 | 04A47D5A1B0A141700CD74C2 /* CycleViewDemoTests */, 192 | ); 193 | }; 194 | /* End PBXProject section */ 195 | 196 | /* Begin PBXResourcesBuildPhase section */ 197 | 04A47D441B0A141700CD74C2 /* Resources */ = { 198 | isa = PBXResourcesBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | 04A47D511B0A141700CD74C2 /* Main.storyboard in Resources */, 202 | 04A47D561B0A141700CD74C2 /* LaunchScreen.xib in Resources */, 203 | 04A47D531B0A141700CD74C2 /* Images.xcassets in Resources */, 204 | ); 205 | runOnlyForDeploymentPostprocessing = 0; 206 | }; 207 | 04A47D591B0A141700CD74C2 /* Resources */ = { 208 | isa = PBXResourcesBuildPhase; 209 | buildActionMask = 2147483647; 210 | files = ( 211 | ); 212 | runOnlyForDeploymentPostprocessing = 0; 213 | }; 214 | /* End PBXResourcesBuildPhase section */ 215 | 216 | /* Begin PBXSourcesBuildPhase section */ 217 | 04A47D421B0A141700CD74C2 /* Sources */ = { 218 | isa = PBXSourcesBuildPhase; 219 | buildActionMask = 2147483647; 220 | files = ( 221 | 76B220401B0CB6A9007F667C /* PictureViewController.swift in Sources */, 222 | 7677356B1B154E71005B60C6 /* AnimatorViewController.swift in Sources */, 223 | 04A47D4E1B0A141700CD74C2 /* ViewController.swift in Sources */, 224 | 04A47D4C1B0A141700CD74C2 /* AppDelegate.swift in Sources */, 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | }; 228 | 04A47D571B0A141700CD74C2 /* Sources */ = { 229 | isa = PBXSourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | 04A47D621B0A141700CD74C2 /* CycleViewDemoTests.swift in Sources */, 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | }; 236 | /* End PBXSourcesBuildPhase section */ 237 | 238 | /* Begin PBXTargetDependency section */ 239 | 04A47D5D1B0A141700CD74C2 /* PBXTargetDependency */ = { 240 | isa = PBXTargetDependency; 241 | target = 04A47D451B0A141700CD74C2 /* CycleViewDemo */; 242 | targetProxy = 04A47D5C1B0A141700CD74C2 /* PBXContainerItemProxy */; 243 | }; 244 | /* End PBXTargetDependency section */ 245 | 246 | /* Begin PBXVariantGroup section */ 247 | 04A47D4F1B0A141700CD74C2 /* Main.storyboard */ = { 248 | isa = PBXVariantGroup; 249 | children = ( 250 | 04A47D501B0A141700CD74C2 /* Base */, 251 | ); 252 | name = Main.storyboard; 253 | sourceTree = ""; 254 | }; 255 | 04A47D541B0A141700CD74C2 /* LaunchScreen.xib */ = { 256 | isa = PBXVariantGroup; 257 | children = ( 258 | 04A47D551B0A141700CD74C2 /* Base */, 259 | ); 260 | name = LaunchScreen.xib; 261 | sourceTree = ""; 262 | }; 263 | /* End PBXVariantGroup section */ 264 | 265 | /* Begin XCBuildConfiguration section */ 266 | 04A47D631B0A141700CD74C2 /* Debug */ = { 267 | isa = XCBuildConfiguration; 268 | buildSettings = { 269 | ALWAYS_SEARCH_USER_PATHS = NO; 270 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 271 | CLANG_CXX_LIBRARY = "libc++"; 272 | CLANG_ENABLE_MODULES = YES; 273 | CLANG_ENABLE_OBJC_ARC = YES; 274 | CLANG_WARN_BOOL_CONVERSION = YES; 275 | CLANG_WARN_CONSTANT_CONVERSION = YES; 276 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 277 | CLANG_WARN_EMPTY_BODY = YES; 278 | CLANG_WARN_ENUM_CONVERSION = YES; 279 | CLANG_WARN_INT_CONVERSION = YES; 280 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 281 | CLANG_WARN_UNREACHABLE_CODE = YES; 282 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 283 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 284 | COPY_PHASE_STRIP = NO; 285 | ENABLE_STRICT_OBJC_MSGSEND = YES; 286 | GCC_C_LANGUAGE_STANDARD = gnu99; 287 | GCC_DYNAMIC_NO_PIC = NO; 288 | GCC_OPTIMIZATION_LEVEL = 0; 289 | GCC_PREPROCESSOR_DEFINITIONS = ( 290 | "DEBUG=1", 291 | "$(inherited)", 292 | ); 293 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 294 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 295 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 296 | GCC_WARN_UNDECLARED_SELECTOR = YES; 297 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 298 | GCC_WARN_UNUSED_FUNCTION = YES; 299 | GCC_WARN_UNUSED_VARIABLE = YES; 300 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 301 | MTL_ENABLE_DEBUG_INFO = YES; 302 | ONLY_ACTIVE_ARCH = YES; 303 | SDKROOT = iphoneos; 304 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 305 | }; 306 | name = Debug; 307 | }; 308 | 04A47D641B0A141700CD74C2 /* Release */ = { 309 | isa = XCBuildConfiguration; 310 | buildSettings = { 311 | ALWAYS_SEARCH_USER_PATHS = NO; 312 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 313 | CLANG_CXX_LIBRARY = "libc++"; 314 | CLANG_ENABLE_MODULES = YES; 315 | CLANG_ENABLE_OBJC_ARC = YES; 316 | CLANG_WARN_BOOL_CONVERSION = YES; 317 | CLANG_WARN_CONSTANT_CONVERSION = YES; 318 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 319 | CLANG_WARN_EMPTY_BODY = YES; 320 | CLANG_WARN_ENUM_CONVERSION = YES; 321 | CLANG_WARN_INT_CONVERSION = YES; 322 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 323 | CLANG_WARN_UNREACHABLE_CODE = YES; 324 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 325 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 326 | COPY_PHASE_STRIP = YES; 327 | ENABLE_NS_ASSERTIONS = NO; 328 | ENABLE_STRICT_OBJC_MSGSEND = YES; 329 | GCC_C_LANGUAGE_STANDARD = gnu99; 330 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 331 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 332 | GCC_WARN_UNDECLARED_SELECTOR = YES; 333 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 334 | GCC_WARN_UNUSED_FUNCTION = YES; 335 | GCC_WARN_UNUSED_VARIABLE = YES; 336 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 337 | MTL_ENABLE_DEBUG_INFO = NO; 338 | SDKROOT = iphoneos; 339 | VALIDATE_PRODUCT = YES; 340 | }; 341 | name = Release; 342 | }; 343 | 04A47D661B0A141700CD74C2 /* Debug */ = { 344 | isa = XCBuildConfiguration; 345 | buildSettings = { 346 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 347 | INFOPLIST_FILE = CycleViewDemo/Info.plist; 348 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 349 | PRODUCT_NAME = "$(TARGET_NAME)"; 350 | }; 351 | name = Debug; 352 | }; 353 | 04A47D671B0A141700CD74C2 /* Release */ = { 354 | isa = XCBuildConfiguration; 355 | buildSettings = { 356 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 357 | INFOPLIST_FILE = CycleViewDemo/Info.plist; 358 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 359 | PRODUCT_NAME = "$(TARGET_NAME)"; 360 | }; 361 | name = Release; 362 | }; 363 | 04A47D691B0A141700CD74C2 /* Debug */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | BUNDLE_LOADER = "$(TEST_HOST)"; 367 | FRAMEWORK_SEARCH_PATHS = ( 368 | "$(SDKROOT)/Developer/Library/Frameworks", 369 | "$(inherited)", 370 | ); 371 | GCC_PREPROCESSOR_DEFINITIONS = ( 372 | "DEBUG=1", 373 | "$(inherited)", 374 | ); 375 | INFOPLIST_FILE = CycleViewDemoTests/Info.plist; 376 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 377 | PRODUCT_NAME = "$(TARGET_NAME)"; 378 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CycleViewDemo.app/CycleViewDemo"; 379 | }; 380 | name = Debug; 381 | }; 382 | 04A47D6A1B0A141700CD74C2 /* Release */ = { 383 | isa = XCBuildConfiguration; 384 | buildSettings = { 385 | BUNDLE_LOADER = "$(TEST_HOST)"; 386 | FRAMEWORK_SEARCH_PATHS = ( 387 | "$(SDKROOT)/Developer/Library/Frameworks", 388 | "$(inherited)", 389 | ); 390 | INFOPLIST_FILE = CycleViewDemoTests/Info.plist; 391 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 392 | PRODUCT_NAME = "$(TARGET_NAME)"; 393 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CycleViewDemo.app/CycleViewDemo"; 394 | }; 395 | name = Release; 396 | }; 397 | /* End XCBuildConfiguration section */ 398 | 399 | /* Begin XCConfigurationList section */ 400 | 04A47D411B0A141700CD74C2 /* Build configuration list for PBXProject "CycleViewDemo" */ = { 401 | isa = XCConfigurationList; 402 | buildConfigurations = ( 403 | 04A47D631B0A141700CD74C2 /* Debug */, 404 | 04A47D641B0A141700CD74C2 /* Release */, 405 | ); 406 | defaultConfigurationIsVisible = 0; 407 | defaultConfigurationName = Release; 408 | }; 409 | 04A47D651B0A141700CD74C2 /* Build configuration list for PBXNativeTarget "CycleViewDemo" */ = { 410 | isa = XCConfigurationList; 411 | buildConfigurations = ( 412 | 04A47D661B0A141700CD74C2 /* Debug */, 413 | 04A47D671B0A141700CD74C2 /* Release */, 414 | ); 415 | defaultConfigurationIsVisible = 0; 416 | defaultConfigurationName = Release; 417 | }; 418 | 04A47D681B0A141700CD74C2 /* Build configuration list for PBXNativeTarget "CycleViewDemoTests" */ = { 419 | isa = XCConfigurationList; 420 | buildConfigurations = ( 421 | 04A47D691B0A141700CD74C2 /* Debug */, 422 | 04A47D6A1B0A141700CD74C2 /* Release */, 423 | ); 424 | defaultConfigurationIsVisible = 0; 425 | defaultConfigurationName = Release; 426 | }; 427 | /* End XCConfigurationList section */ 428 | }; 429 | rootObject = 04A47D3E1B0A141700CD74C2 /* Project object */; 430 | } 431 | -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo.xcodeproj/xcuserdata/sariel.xcuserdatad/xcschemes/CycleViewDemo.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 | -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo.xcodeproj/xcuserdata/sariel.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CycleViewDemo.xcscheme 8 | 9 | orderHint 10 | 1 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 04A47D451B0A141700CD74C2 16 | 17 | primary 18 | 19 | 20 | 04A47D5A1B0A141700CD74C2 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/AnimatorViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnimatorViewController.swift 3 | // CycleViewDemo 4 | // 5 | // Created by xl_bin on 15/5/27. 6 | // Copyright (c) 2015年 Sariel. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CycleView 11 | 12 | class AnimatorViewController: CycleAnimatorViewController { 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | var arrayM = [UIImage]() 18 | 19 | for var i = 0; i < 16; ++i { 20 | let imageName = String(format: "%02d.jpg", i + 1) 21 | arrayM.append(UIImage(named: imageName)!) 22 | } 23 | // println(arrayM) 24 | AnimatorImageList = arrayM; 25 | AnimationType = SRTransitionAnimateType.SUCKEFFECT.rawValue 26 | AnimatorImageView!.contentMode = UIViewContentMode.ScaleAspectFill 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CycleViewDemo 4 | // 5 | // Created by Sariel's Mac on 15-5-18. 6 | // Copyright (c) 2015年 Sariel. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // 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. 24 | // 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. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // 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. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/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 | -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/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 | 58 | 59 | 60 | 61 | 62 | 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 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/01.imageset/01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SarielTang/CycleView/1184a9e0a6e1380dceb3ad5ca9675a1aedf67085/CycleViewDemo/CycleViewDemo/Images.xcassets/01.imageset/01.png -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/01.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "01.png" 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 | } -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/02.imageset/02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SarielTang/CycleView/1184a9e0a6e1380dceb3ad5ca9675a1aedf67085/CycleViewDemo/CycleViewDemo/Images.xcassets/02.imageset/02.png -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/02.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "02.png" 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 | } -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/03.imageset/03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SarielTang/CycleView/1184a9e0a6e1380dceb3ad5ca9675a1aedf67085/CycleViewDemo/CycleViewDemo/Images.xcassets/03.imageset/03.png -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/03.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "03.png" 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 | } -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/04.imageset/04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SarielTang/CycleView/1184a9e0a6e1380dceb3ad5ca9675a1aedf67085/CycleViewDemo/CycleViewDemo/Images.xcassets/04.imageset/04.png -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/04.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "04.png" 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 | } -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/05.imageset/05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SarielTang/CycleView/1184a9e0a6e1380dceb3ad5ca9675a1aedf67085/CycleViewDemo/CycleViewDemo/Images.xcassets/05.imageset/05.png -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/05.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "05.png" 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 | } -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/06.imageset/06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SarielTang/CycleView/1184a9e0a6e1380dceb3ad5ca9675a1aedf67085/CycleViewDemo/CycleViewDemo/Images.xcassets/06.imageset/06.png -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/06.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "06.png" 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 | } -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/07.imageset/07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SarielTang/CycleView/1184a9e0a6e1380dceb3ad5ca9675a1aedf67085/CycleViewDemo/CycleViewDemo/Images.xcassets/07.imageset/07.png -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/07.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "07.png" 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 | } -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/08.imageset/08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SarielTang/CycleView/1184a9e0a6e1380dceb3ad5ca9675a1aedf67085/CycleViewDemo/CycleViewDemo/Images.xcassets/08.imageset/08.png -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/08.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "08.png" 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 | } -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/09.imageset/09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SarielTang/CycleView/1184a9e0a6e1380dceb3ad5ca9675a1aedf67085/CycleViewDemo/CycleViewDemo/Images.xcassets/09.imageset/09.png -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/09.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "09.png" 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 | } -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/10.imageset/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SarielTang/CycleView/1184a9e0a6e1380dceb3ad5ca9675a1aedf67085/CycleViewDemo/CycleViewDemo/Images.xcassets/10.imageset/10.png -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/10.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "10.png" 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 | } -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/11.imageset/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SarielTang/CycleView/1184a9e0a6e1380dceb3ad5ca9675a1aedf67085/CycleViewDemo/CycleViewDemo/Images.xcassets/11.imageset/11.png -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/11.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "11.png" 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 | } -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/12.imageset/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SarielTang/CycleView/1184a9e0a6e1380dceb3ad5ca9675a1aedf67085/CycleViewDemo/CycleViewDemo/Images.xcassets/12.imageset/12.png -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/12.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "12.png" 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 | } -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/13.imageset/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SarielTang/CycleView/1184a9e0a6e1380dceb3ad5ca9675a1aedf67085/CycleViewDemo/CycleViewDemo/Images.xcassets/13.imageset/13.png -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/13.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "13.png" 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 | } -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/14.imageset/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SarielTang/CycleView/1184a9e0a6e1380dceb3ad5ca9675a1aedf67085/CycleViewDemo/CycleViewDemo/Images.xcassets/14.imageset/14.png -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/14.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "14.png" 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 | } -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/15.imageset/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SarielTang/CycleView/1184a9e0a6e1380dceb3ad5ca9675a1aedf67085/CycleViewDemo/CycleViewDemo/Images.xcassets/15.imageset/15.png -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/15.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "15.png" 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 | } -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/16.imageset/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SarielTang/CycleView/1184a9e0a6e1380dceb3ad5ca9675a1aedf67085/CycleViewDemo/CycleViewDemo/Images.xcassets/16.imageset/16.png -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Images.xcassets/16.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "16.png" 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 | } -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/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 | } -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | Club.Sariel.$(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 | -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/PictureViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PictureViewController.swift 3 | // CycleViewDemo 4 | // 5 | // Created by xl_bin on 15/5/20. 6 | // Copyright (c) 2015年 Sariel. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CycleView 11 | 12 | class PictureViewController: PictureCycleController { 13 | 14 | 15 | override func loadView() { 16 | super.loadView() 17 | } 18 | 19 | override func viewDidLoad() { 20 | super.viewDidLoad() 21 | var arrayM = [UIImage]() 22 | 23 | for var i = 0; i < 16; ++i { 24 | let imageName = String(format: "%02d.jpg", i + 1) 25 | arrayM.append(UIImage(named: imageName)!) 26 | // println(arrayM) 27 | } 28 | CycleImageList = arrayM; 29 | NSLog("") 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // CycleViewDemo 4 | // 5 | // Created by Sariel's Mac on 15-5-18. 6 | // Copyright (c) 2015年 Sariel. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | // Do any additional setup after loading the view, typically from a nib. 16 | } 17 | 18 | override func didReceiveMemoryWarning() { 19 | super.didReceiveMemoryWarning() 20 | // Dispose of any resources that can be recreated. 21 | } 22 | 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemoTests/CycleViewDemoTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CycleViewDemoTests.swift 3 | // CycleViewDemoTests 4 | // 5 | // Created by Sariel's Mac on 15-5-18. 6 | // Copyright (c) 2015年 Sariel. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class CycleViewDemoTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /CycleViewDemo/CycleViewDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | Club.Sariel.$(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 | Copyright (c) 2015 SarielTang <524896762@qq.com> 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## CycleView 2 | 3 | * The easiest way to use infinite-loop-view 4 | * 用法最简单的无限循环的图片轮播器 5 | 6 | ## Requirements 7 | 8 | * iOS 7.0+ 9 | * Xcode 6.3.1 10 | 11 | ## Installation 12 | 13 | ### CocoaPods 14 | 15 | CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command: 16 | 17 | ```bash 18 | $ gem install cocoapods 19 | ``` 20 | 21 | To integrate CycleView into your Xcode project using CocoaPods, specify it in your `Podfile`: 22 | 23 | ``` 24 | platform :ios, '8.0' 25 | use_frameworks! 26 | 27 | pod 'CycleView' 28 | ``` 29 | 30 | Then, run the following command: 31 | 32 | ```bash 33 | $ pod install 34 | ``` 35 | 36 | You should open the `{Project}.xcworkspace` instead of the `{Project}.xcodeproj` after you installed anything from CocoaPods. 37 | 38 | For more information about how to use CocoaPods, I suggest [this tutorial](http://www.raywenderlich.com/64546/introduction-to-cocoapods-2). 39 | 40 | ## 如何使用CycleView 41 | * cocoapods导入:`pod 'CycleView'` 42 | * 手动导入: 43 | * 将`CycleView/CycleView/Source`文件夹中的所有文件拽入项目中 44 | * 导入主头文件:`#import "CycleView.h"` 45 | 46 | ## Usage 47 | 48 | ### Swift 49 | #### Regular 50 | 51 | ```swift 52 | import CycleView 53 | 54 | class className : PictureCycleController{ 55 | 56 | //override loadView function 57 | //重写loadViewe方法 58 | override func loadView() { 59 | super.loadView() 60 | } 61 | 62 | var arrayM: [UIImage]? 63 | 64 | override func viewDidLoad() { 65 | super.viewDidLoad() 66 | //input an Array with UIImage 67 | //传入一个UIImage的图像数组 68 | CycleImageList = arrayM; 69 | } 70 | 71 | } 72 | 73 | ``` 74 | 75 | #### Special 76 | ```swift 77 | import CycleView 78 | 79 | class AnimatorViewController: CycleAnimatorViewController { 80 | 81 | override func viewDidLoad() { 82 | super.viewDidLoad() 83 | 84 | var arrayM = [UIImage]() 85 | for var i = 0; i < 16; ++i { 86 | let imageName = String(format: "%02d.jpg", i + 1) 87 | arrayM.append(UIImage(named: imageName)!) 88 | } 89 | AnimatorImageList = arrayM; 90 | 91 | //you can modify the animation effect by enumeration type 92 | //可以通过枚举类型,修改动画效果 93 | AnimationType = SRTransitionAnimateType.CUBE.rawValue 94 | //you can change image's contentMode 95 | //可以设置图片填充模式 96 | AnimatorImageView!.contentMode = UIViewContentMode.ScaleAspectFit 97 | } 98 | } 99 | ``` 100 | 101 | ## Screenshot 102 | 103 | ``` 104 | 常规图片轮播器 105 | ``` 106 | * ![image](https://github.com/SarielTang/ScreenShot/blob/master/CycleViewIntroduce1.gif) 107 | 108 | ``` 109 | 立体旋转效果 110 | ``` 111 | * ![image](https://github.com/SarielTang/ScreenShot/blob/master/CycleViewIntroduce2.gif) 112 | 113 | ``` 114 | 淡入淡出效果 115 | ``` 116 | * ![image](https://github.com/SarielTang/ScreenShot/blob/master/CycleViewIntroduce3.gif) 117 | 118 | ``` 119 | 平面翻转效果 120 | ``` 121 | * ![image](https://github.com/SarielTang/ScreenShot/blob/master/CycleViewIntroduce4.gif) 122 | 123 | ``` 124 | 翻页效果 125 | ``` 126 | * ![image](https://github.com/SarielTang/ScreenShot/blob/master/CycleViewIntroduce5.gif) 127 | 128 | ``` 129 | 反向翻页效果 130 | ``` 131 | * ![image](https://github.com/SarielTang/ScreenShot/blob/master/CycleViewIntroduce6.gif) 132 | 133 | ``` 134 | 横向推出效果 135 | ``` 136 | * ![image](https://github.com/SarielTang/ScreenShot/blob/master/CycleViewIntroduce7.gif) 137 | 138 | ``` 139 | 从上层抽出效果 140 | ``` 141 | * ![image](https://github.com/SarielTang/ScreenShot/blob/master/CycleViewIntroduce8.gif) 142 | 143 | ``` 144 | 水滴效果 145 | ``` 146 | * ![image](https://github.com/SarielTang/ScreenShot/blob/master/CycleViewIntroduce9.gif) 147 | 148 | ``` 149 | 从角落收起效果 150 | ``` 151 | * ![image](https://github.com/SarielTang/ScreenShot/blob/master/CycleViewIntroduce10.gif) 152 | 153 | --------------------------------------------------------------------------------