├── .gitignore ├── .gitmodules ├── .travis.yml ├── Examples └── ImagePlayerViewDemo │ ├── ImagePlayerViewDemo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── ImagePlayerViewDemo.xcscheme │ ├── ImagePlayerViewDemo │ ├── Base.lproj │ │ └── Main.storyboard │ ├── ICAppDelegate.h │ ├── ICAppDelegate.m │ ├── ICViewController.h │ ├── ICViewController.m │ ├── ImagePlayerViewDemo-Info.plist │ ├── ImagePlayerViewDemo-Prefix.pch │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ ├── en.lproj │ │ └── InfoPlist.strings │ └── main.m │ └── ImagePlayerViewDemoTests │ ├── ImagePlayerViewDemoTests-Info.plist │ ├── ImagePlayerViewDemoTests.m │ └── en.lproj │ └── InfoPlist.strings ├── ImagePlayerView.podspec ├── ImagePlayerView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata ├── xcshareddata │ └── xcschemes │ │ └── ImagePlayerView.xcscheme └── xcuserdata │ └── chenyanjun.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── ImagePlayerView ├── ImagePlayerView-Prefix.pch ├── ImagePlayerView.h └── ImagePlayerView.m ├── ImagePlayerViewTests ├── ImagePlayerViewTests-Info.plist ├── ImagePlayerViewTests.m └── en.lproj │ └── InfoPlist.strings ├── Images └── ImagePlayerView-01.png ├── LICENSE ├── README.md └── endless.gif /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control? 25 | # 26 | # Pods/ 27 | 28 | 29 | .DS_Store 30 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/interchen/ImagePlayerView/3e4b7c88c98438b29f12bec679a2c7697751dc38/.gitmodules -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | script: xcodebuild -project Examples/ImagePlayerViewDemo/ImagePlayerViewDemo.xcodeproj -scheme ImagePlayerViewDemo -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO 3 | -------------------------------------------------------------------------------- /Examples/ImagePlayerViewDemo/ImagePlayerViewDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4B29CFA819414861009D65CA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B29CFA719414861009D65CA /* Foundation.framework */; }; 11 | 4B29CFAA19414861009D65CA /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B29CFA919414861009D65CA /* CoreGraphics.framework */; }; 12 | 4B29CFAC19414861009D65CA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B29CFAB19414861009D65CA /* UIKit.framework */; }; 13 | 4B29CFB219414861009D65CA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4B29CFB019414861009D65CA /* InfoPlist.strings */; }; 14 | 4B29CFB419414861009D65CA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B29CFB319414861009D65CA /* main.m */; }; 15 | 4B29CFB819414861009D65CA /* ICAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B29CFB719414861009D65CA /* ICAppDelegate.m */; }; 16 | 4B29CFBB19414861009D65CA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B29CFB919414861009D65CA /* Main.storyboard */; }; 17 | 4B29CFBE19414861009D65CA /* ICViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B29CFBD19414861009D65CA /* ICViewController.m */; }; 18 | 4B29CFC019414861009D65CA /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4B29CFBF19414861009D65CA /* Images.xcassets */; }; 19 | 4B29CFC719414861009D65CA /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B29CFC619414861009D65CA /* XCTest.framework */; }; 20 | 4B29CFC819414861009D65CA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B29CFA719414861009D65CA /* Foundation.framework */; }; 21 | 4B29CFC919414861009D65CA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B29CFAB19414861009D65CA /* UIKit.framework */; }; 22 | 4B29CFD119414861009D65CA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4B29CFCF19414861009D65CA /* InfoPlist.strings */; }; 23 | 4B29CFD319414861009D65CA /* ImagePlayerViewDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B29CFD219414861009D65CA /* ImagePlayerViewDemoTests.m */; }; 24 | 4B29CFF519414BB5009D65CA /* libImagePlayerView.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B29CFF219414B90009D65CA /* libImagePlayerView.a */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXContainerItemProxy section */ 28 | 4B29CFCA19414861009D65CA /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = 4B29CF9C19414861009D65CA /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = 4B29CFA319414861009D65CA; 33 | remoteInfo = ImagePlayerViewDemo; 34 | }; 35 | 4B29CFF119414B90009D65CA /* PBXContainerItemProxy */ = { 36 | isa = PBXContainerItemProxy; 37 | containerPortal = 4B29CFEB19414B90009D65CA /* ImagePlayerView.xcodeproj */; 38 | proxyType = 2; 39 | remoteGlobalIDString = 4B6F44E519402114003A88A8; 40 | remoteInfo = ImagePlayerView; 41 | }; 42 | 4B29CFF319414B90009D65CA /* PBXContainerItemProxy */ = { 43 | isa = PBXContainerItemProxy; 44 | containerPortal = 4B29CFEB19414B90009D65CA /* ImagePlayerView.xcodeproj */; 45 | proxyType = 2; 46 | remoteGlobalIDString = 4B6F44F519402114003A88A8; 47 | remoteInfo = ImagePlayerViewTests; 48 | }; 49 | 4B29CFF619414BCC009D65CA /* PBXContainerItemProxy */ = { 50 | isa = PBXContainerItemProxy; 51 | containerPortal = 4B29CFEB19414B90009D65CA /* ImagePlayerView.xcodeproj */; 52 | proxyType = 1; 53 | remoteGlobalIDString = 4B6F44E419402114003A88A8; 54 | remoteInfo = ImagePlayerView; 55 | }; 56 | /* End PBXContainerItemProxy section */ 57 | 58 | /* Begin PBXFileReference section */ 59 | 4B29CFA419414861009D65CA /* ImagePlayerViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ImagePlayerViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | 4B29CFA719414861009D65CA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 61 | 4B29CFA919414861009D65CA /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 62 | 4B29CFAB19414861009D65CA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 63 | 4B29CFAF19414861009D65CA /* ImagePlayerViewDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ImagePlayerViewDemo-Info.plist"; sourceTree = ""; }; 64 | 4B29CFB119414861009D65CA /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 65 | 4B29CFB319414861009D65CA /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 66 | 4B29CFB519414861009D65CA /* ImagePlayerViewDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ImagePlayerViewDemo-Prefix.pch"; sourceTree = ""; }; 67 | 4B29CFB619414861009D65CA /* ICAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ICAppDelegate.h; sourceTree = ""; }; 68 | 4B29CFB719414861009D65CA /* ICAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ICAppDelegate.m; sourceTree = ""; }; 69 | 4B29CFBA19414861009D65CA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 70 | 4B29CFBC19414861009D65CA /* ICViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ICViewController.h; sourceTree = ""; }; 71 | 4B29CFBD19414861009D65CA /* ICViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ICViewController.m; sourceTree = ""; }; 72 | 4B29CFBF19414861009D65CA /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 73 | 4B29CFC519414861009D65CA /* ImagePlayerViewDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ImagePlayerViewDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 74 | 4B29CFC619414861009D65CA /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 75 | 4B29CFCE19414861009D65CA /* ImagePlayerViewDemoTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ImagePlayerViewDemoTests-Info.plist"; sourceTree = ""; }; 76 | 4B29CFD019414861009D65CA /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 77 | 4B29CFD219414861009D65CA /* ImagePlayerViewDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ImagePlayerViewDemoTests.m; sourceTree = ""; }; 78 | 4B29CFEB19414B90009D65CA /* ImagePlayerView.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ImagePlayerView.xcodeproj; path = ../../ImagePlayerView.xcodeproj; sourceTree = ""; }; 79 | 4B29D00219415120009D65CA /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; }; 80 | /* End PBXFileReference section */ 81 | 82 | /* Begin PBXFrameworksBuildPhase section */ 83 | 4B29CFA119414861009D65CA /* Frameworks */ = { 84 | isa = PBXFrameworksBuildPhase; 85 | buildActionMask = 2147483647; 86 | files = ( 87 | 4B29CFF519414BB5009D65CA /* libImagePlayerView.a in Frameworks */, 88 | 4B29CFAA19414861009D65CA /* CoreGraphics.framework in Frameworks */, 89 | 4B29CFAC19414861009D65CA /* UIKit.framework in Frameworks */, 90 | 4B29CFA819414861009D65CA /* Foundation.framework in Frameworks */, 91 | ); 92 | runOnlyForDeploymentPostprocessing = 0; 93 | }; 94 | 4B29CFC219414861009D65CA /* Frameworks */ = { 95 | isa = PBXFrameworksBuildPhase; 96 | buildActionMask = 2147483647; 97 | files = ( 98 | 4B29CFC719414861009D65CA /* XCTest.framework in Frameworks */, 99 | 4B29CFC919414861009D65CA /* UIKit.framework in Frameworks */, 100 | 4B29CFC819414861009D65CA /* Foundation.framework in Frameworks */, 101 | ); 102 | runOnlyForDeploymentPostprocessing = 0; 103 | }; 104 | /* End PBXFrameworksBuildPhase section */ 105 | 106 | /* Begin PBXGroup section */ 107 | 4B29CF9B19414861009D65CA = { 108 | isa = PBXGroup; 109 | children = ( 110 | 4B29CFAD19414861009D65CA /* ImagePlayerViewDemo */, 111 | 4B29CFCC19414861009D65CA /* ImagePlayerViewDemoTests */, 112 | 4B29CFA619414861009D65CA /* Frameworks */, 113 | 4B29CFA519414861009D65CA /* Products */, 114 | ); 115 | sourceTree = ""; 116 | }; 117 | 4B29CFA519414861009D65CA /* Products */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 4B29CFA419414861009D65CA /* ImagePlayerViewDemo.app */, 121 | 4B29CFC519414861009D65CA /* ImagePlayerViewDemoTests.xctest */, 122 | ); 123 | name = Products; 124 | sourceTree = ""; 125 | }; 126 | 4B29CFA619414861009D65CA /* Frameworks */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 4B29D00219415120009D65CA /* ImageIO.framework */, 130 | 4B29CFEB19414B90009D65CA /* ImagePlayerView.xcodeproj */, 131 | 4B29CFA719414861009D65CA /* Foundation.framework */, 132 | 4B29CFA919414861009D65CA /* CoreGraphics.framework */, 133 | 4B29CFAB19414861009D65CA /* UIKit.framework */, 134 | 4B29CFC619414861009D65CA /* XCTest.framework */, 135 | ); 136 | name = Frameworks; 137 | sourceTree = ""; 138 | }; 139 | 4B29CFAD19414861009D65CA /* ImagePlayerViewDemo */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | 4B29CFB619414861009D65CA /* ICAppDelegate.h */, 143 | 4B29CFB719414861009D65CA /* ICAppDelegate.m */, 144 | 4B29CFB919414861009D65CA /* Main.storyboard */, 145 | 4B29CFBC19414861009D65CA /* ICViewController.h */, 146 | 4B29CFBD19414861009D65CA /* ICViewController.m */, 147 | 4B29CFBF19414861009D65CA /* Images.xcassets */, 148 | 4B29CFAE19414861009D65CA /* Supporting Files */, 149 | ); 150 | path = ImagePlayerViewDemo; 151 | sourceTree = ""; 152 | }; 153 | 4B29CFAE19414861009D65CA /* Supporting Files */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | 4B29CFAF19414861009D65CA /* ImagePlayerViewDemo-Info.plist */, 157 | 4B29CFB019414861009D65CA /* InfoPlist.strings */, 158 | 4B29CFB319414861009D65CA /* main.m */, 159 | 4B29CFB519414861009D65CA /* ImagePlayerViewDemo-Prefix.pch */, 160 | ); 161 | name = "Supporting Files"; 162 | sourceTree = ""; 163 | }; 164 | 4B29CFCC19414861009D65CA /* ImagePlayerViewDemoTests */ = { 165 | isa = PBXGroup; 166 | children = ( 167 | 4B29CFD219414861009D65CA /* ImagePlayerViewDemoTests.m */, 168 | 4B29CFCD19414861009D65CA /* Supporting Files */, 169 | ); 170 | path = ImagePlayerViewDemoTests; 171 | sourceTree = ""; 172 | }; 173 | 4B29CFCD19414861009D65CA /* Supporting Files */ = { 174 | isa = PBXGroup; 175 | children = ( 176 | 4B29CFCE19414861009D65CA /* ImagePlayerViewDemoTests-Info.plist */, 177 | 4B29CFCF19414861009D65CA /* InfoPlist.strings */, 178 | ); 179 | name = "Supporting Files"; 180 | sourceTree = ""; 181 | }; 182 | 4B29CFEC19414B90009D65CA /* Products */ = { 183 | isa = PBXGroup; 184 | children = ( 185 | 4B29CFF219414B90009D65CA /* libImagePlayerView.a */, 186 | 4B29CFF419414B90009D65CA /* ImagePlayerViewTests.xctest */, 187 | ); 188 | name = Products; 189 | sourceTree = ""; 190 | }; 191 | /* End PBXGroup section */ 192 | 193 | /* Begin PBXNativeTarget section */ 194 | 4B29CFA319414861009D65CA /* ImagePlayerViewDemo */ = { 195 | isa = PBXNativeTarget; 196 | buildConfigurationList = 4B29CFD619414861009D65CA /* Build configuration list for PBXNativeTarget "ImagePlayerViewDemo" */; 197 | buildPhases = ( 198 | 4B29CFA019414861009D65CA /* Sources */, 199 | 4B29CFA119414861009D65CA /* Frameworks */, 200 | 4B29CFA219414861009D65CA /* Resources */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | 4B29CFF719414BCC009D65CA /* PBXTargetDependency */, 206 | ); 207 | name = ImagePlayerViewDemo; 208 | productName = ImagePlayerViewDemo; 209 | productReference = 4B29CFA419414861009D65CA /* ImagePlayerViewDemo.app */; 210 | productType = "com.apple.product-type.application"; 211 | }; 212 | 4B29CFC419414861009D65CA /* ImagePlayerViewDemoTests */ = { 213 | isa = PBXNativeTarget; 214 | buildConfigurationList = 4B29CFD919414861009D65CA /* Build configuration list for PBXNativeTarget "ImagePlayerViewDemoTests" */; 215 | buildPhases = ( 216 | 4B29CFC119414861009D65CA /* Sources */, 217 | 4B29CFC219414861009D65CA /* Frameworks */, 218 | 4B29CFC319414861009D65CA /* Resources */, 219 | ); 220 | buildRules = ( 221 | ); 222 | dependencies = ( 223 | 4B29CFCB19414861009D65CA /* PBXTargetDependency */, 224 | ); 225 | name = ImagePlayerViewDemoTests; 226 | productName = ImagePlayerViewDemoTests; 227 | productReference = 4B29CFC519414861009D65CA /* ImagePlayerViewDemoTests.xctest */; 228 | productType = "com.apple.product-type.bundle.unit-test"; 229 | }; 230 | /* End PBXNativeTarget section */ 231 | 232 | /* Begin PBXProject section */ 233 | 4B29CF9C19414861009D65CA /* Project object */ = { 234 | isa = PBXProject; 235 | attributes = { 236 | CLASSPREFIX = IC; 237 | LastUpgradeCheck = 0730; 238 | ORGANIZATIONNAME = Chenyanjun; 239 | TargetAttributes = { 240 | 4B29CFC419414861009D65CA = { 241 | TestTargetID = 4B29CFA319414861009D65CA; 242 | }; 243 | }; 244 | }; 245 | buildConfigurationList = 4B29CF9F19414861009D65CA /* Build configuration list for PBXProject "ImagePlayerViewDemo" */; 246 | compatibilityVersion = "Xcode 3.2"; 247 | developmentRegion = English; 248 | hasScannedForEncodings = 0; 249 | knownRegions = ( 250 | en, 251 | Base, 252 | ); 253 | mainGroup = 4B29CF9B19414861009D65CA; 254 | productRefGroup = 4B29CFA519414861009D65CA /* Products */; 255 | projectDirPath = ""; 256 | projectReferences = ( 257 | { 258 | ProductGroup = 4B29CFEC19414B90009D65CA /* Products */; 259 | ProjectRef = 4B29CFEB19414B90009D65CA /* ImagePlayerView.xcodeproj */; 260 | }, 261 | ); 262 | projectRoot = ""; 263 | targets = ( 264 | 4B29CFA319414861009D65CA /* ImagePlayerViewDemo */, 265 | 4B29CFC419414861009D65CA /* ImagePlayerViewDemoTests */, 266 | ); 267 | }; 268 | /* End PBXProject section */ 269 | 270 | /* Begin PBXReferenceProxy section */ 271 | 4B29CFF219414B90009D65CA /* libImagePlayerView.a */ = { 272 | isa = PBXReferenceProxy; 273 | fileType = archive.ar; 274 | path = libImagePlayerView.a; 275 | remoteRef = 4B29CFF119414B90009D65CA /* PBXContainerItemProxy */; 276 | sourceTree = BUILT_PRODUCTS_DIR; 277 | }; 278 | 4B29CFF419414B90009D65CA /* ImagePlayerViewTests.xctest */ = { 279 | isa = PBXReferenceProxy; 280 | fileType = wrapper.cfbundle; 281 | path = ImagePlayerViewTests.xctest; 282 | remoteRef = 4B29CFF319414B90009D65CA /* PBXContainerItemProxy */; 283 | sourceTree = BUILT_PRODUCTS_DIR; 284 | }; 285 | /* End PBXReferenceProxy section */ 286 | 287 | /* Begin PBXResourcesBuildPhase section */ 288 | 4B29CFA219414861009D65CA /* Resources */ = { 289 | isa = PBXResourcesBuildPhase; 290 | buildActionMask = 2147483647; 291 | files = ( 292 | 4B29CFC019414861009D65CA /* Images.xcassets in Resources */, 293 | 4B29CFB219414861009D65CA /* InfoPlist.strings in Resources */, 294 | 4B29CFBB19414861009D65CA /* Main.storyboard in Resources */, 295 | ); 296 | runOnlyForDeploymentPostprocessing = 0; 297 | }; 298 | 4B29CFC319414861009D65CA /* Resources */ = { 299 | isa = PBXResourcesBuildPhase; 300 | buildActionMask = 2147483647; 301 | files = ( 302 | 4B29CFD119414861009D65CA /* InfoPlist.strings in Resources */, 303 | ); 304 | runOnlyForDeploymentPostprocessing = 0; 305 | }; 306 | /* End PBXResourcesBuildPhase section */ 307 | 308 | /* Begin PBXSourcesBuildPhase section */ 309 | 4B29CFA019414861009D65CA /* Sources */ = { 310 | isa = PBXSourcesBuildPhase; 311 | buildActionMask = 2147483647; 312 | files = ( 313 | 4B29CFB819414861009D65CA /* ICAppDelegate.m in Sources */, 314 | 4B29CFB419414861009D65CA /* main.m in Sources */, 315 | 4B29CFBE19414861009D65CA /* ICViewController.m in Sources */, 316 | ); 317 | runOnlyForDeploymentPostprocessing = 0; 318 | }; 319 | 4B29CFC119414861009D65CA /* Sources */ = { 320 | isa = PBXSourcesBuildPhase; 321 | buildActionMask = 2147483647; 322 | files = ( 323 | 4B29CFD319414861009D65CA /* ImagePlayerViewDemoTests.m in Sources */, 324 | ); 325 | runOnlyForDeploymentPostprocessing = 0; 326 | }; 327 | /* End PBXSourcesBuildPhase section */ 328 | 329 | /* Begin PBXTargetDependency section */ 330 | 4B29CFCB19414861009D65CA /* PBXTargetDependency */ = { 331 | isa = PBXTargetDependency; 332 | target = 4B29CFA319414861009D65CA /* ImagePlayerViewDemo */; 333 | targetProxy = 4B29CFCA19414861009D65CA /* PBXContainerItemProxy */; 334 | }; 335 | 4B29CFF719414BCC009D65CA /* PBXTargetDependency */ = { 336 | isa = PBXTargetDependency; 337 | name = ImagePlayerView; 338 | targetProxy = 4B29CFF619414BCC009D65CA /* PBXContainerItemProxy */; 339 | }; 340 | /* End PBXTargetDependency section */ 341 | 342 | /* Begin PBXVariantGroup section */ 343 | 4B29CFB019414861009D65CA /* InfoPlist.strings */ = { 344 | isa = PBXVariantGroup; 345 | children = ( 346 | 4B29CFB119414861009D65CA /* en */, 347 | ); 348 | name = InfoPlist.strings; 349 | sourceTree = ""; 350 | }; 351 | 4B29CFB919414861009D65CA /* Main.storyboard */ = { 352 | isa = PBXVariantGroup; 353 | children = ( 354 | 4B29CFBA19414861009D65CA /* Base */, 355 | ); 356 | name = Main.storyboard; 357 | sourceTree = ""; 358 | }; 359 | 4B29CFCF19414861009D65CA /* InfoPlist.strings */ = { 360 | isa = PBXVariantGroup; 361 | children = ( 362 | 4B29CFD019414861009D65CA /* en */, 363 | ); 364 | name = InfoPlist.strings; 365 | sourceTree = ""; 366 | }; 367 | /* End PBXVariantGroup section */ 368 | 369 | /* Begin XCBuildConfiguration section */ 370 | 4B29CFD419414861009D65CA /* Debug */ = { 371 | isa = XCBuildConfiguration; 372 | buildSettings = { 373 | ALWAYS_SEARCH_USER_PATHS = NO; 374 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 375 | CLANG_CXX_LIBRARY = "libc++"; 376 | CLANG_ENABLE_MODULES = YES; 377 | CLANG_ENABLE_OBJC_ARC = YES; 378 | CLANG_WARN_BOOL_CONVERSION = YES; 379 | CLANG_WARN_CONSTANT_CONVERSION = YES; 380 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 381 | CLANG_WARN_EMPTY_BODY = YES; 382 | CLANG_WARN_ENUM_CONVERSION = YES; 383 | CLANG_WARN_INT_CONVERSION = YES; 384 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 385 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 386 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 387 | COPY_PHASE_STRIP = NO; 388 | ENABLE_TESTABILITY = YES; 389 | GCC_C_LANGUAGE_STANDARD = gnu99; 390 | GCC_DYNAMIC_NO_PIC = NO; 391 | GCC_OPTIMIZATION_LEVEL = 0; 392 | GCC_PREPROCESSOR_DEFINITIONS = ( 393 | "DEBUG=1", 394 | "$(inherited)", 395 | ); 396 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 397 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 398 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 399 | GCC_WARN_UNDECLARED_SELECTOR = YES; 400 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 401 | GCC_WARN_UNUSED_FUNCTION = YES; 402 | GCC_WARN_UNUSED_VARIABLE = YES; 403 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 404 | ONLY_ACTIVE_ARCH = YES; 405 | SDKROOT = iphoneos; 406 | }; 407 | name = Debug; 408 | }; 409 | 4B29CFD519414861009D65CA /* Release */ = { 410 | isa = XCBuildConfiguration; 411 | buildSettings = { 412 | ALWAYS_SEARCH_USER_PATHS = NO; 413 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 414 | CLANG_CXX_LIBRARY = "libc++"; 415 | CLANG_ENABLE_MODULES = YES; 416 | CLANG_ENABLE_OBJC_ARC = YES; 417 | CLANG_WARN_BOOL_CONVERSION = YES; 418 | CLANG_WARN_CONSTANT_CONVERSION = YES; 419 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 420 | CLANG_WARN_EMPTY_BODY = YES; 421 | CLANG_WARN_ENUM_CONVERSION = YES; 422 | CLANG_WARN_INT_CONVERSION = YES; 423 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 424 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 425 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 426 | COPY_PHASE_STRIP = YES; 427 | ENABLE_NS_ASSERTIONS = NO; 428 | GCC_C_LANGUAGE_STANDARD = gnu99; 429 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 430 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 431 | GCC_WARN_UNDECLARED_SELECTOR = YES; 432 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 433 | GCC_WARN_UNUSED_FUNCTION = YES; 434 | GCC_WARN_UNUSED_VARIABLE = YES; 435 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 436 | SDKROOT = iphoneos; 437 | VALIDATE_PRODUCT = YES; 438 | }; 439 | name = Release; 440 | }; 441 | 4B29CFD719414861009D65CA /* Debug */ = { 442 | isa = XCBuildConfiguration; 443 | buildSettings = { 444 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 445 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 446 | FRAMEWORK_SEARCH_PATHS = ( 447 | "$(inherited)", 448 | "\"$(SRCROOT)\"", 449 | ); 450 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 451 | GCC_PREFIX_HEADER = "ImagePlayerViewDemo/ImagePlayerViewDemo-Prefix.pch"; 452 | HEADER_SEARCH_PATHS = ( 453 | "$(inherited)", 454 | "\"$(TARGET_BUILD_DIR)/usr/local/lib/include\"", 455 | "\"$(OBJROOT)/UninstalledProducts/include\"", 456 | ); 457 | INFOPLIST_FILE = "ImagePlayerViewDemo/ImagePlayerViewDemo-Info.plist"; 458 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 459 | OTHER_LDFLAGS = "-ObjC"; 460 | PRODUCT_BUNDLE_IDENTIFIER = "com.chenyanjun.${PRODUCT_NAME:rfc1034identifier}"; 461 | PRODUCT_NAME = "$(TARGET_NAME)"; 462 | WRAPPER_EXTENSION = app; 463 | }; 464 | name = Debug; 465 | }; 466 | 4B29CFD819414861009D65CA /* Release */ = { 467 | isa = XCBuildConfiguration; 468 | buildSettings = { 469 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 470 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 471 | FRAMEWORK_SEARCH_PATHS = ( 472 | "$(inherited)", 473 | "\"$(SRCROOT)\"", 474 | ); 475 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 476 | GCC_PREFIX_HEADER = "ImagePlayerViewDemo/ImagePlayerViewDemo-Prefix.pch"; 477 | HEADER_SEARCH_PATHS = ( 478 | "$(inherited)", 479 | "\"$(TARGET_BUILD_DIR)/usr/local/lib/include\"", 480 | "\"$(OBJROOT)/UninstalledProducts/include\"", 481 | ); 482 | INFOPLIST_FILE = "ImagePlayerViewDemo/ImagePlayerViewDemo-Info.plist"; 483 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 484 | OTHER_LDFLAGS = "-ObjC"; 485 | PRODUCT_BUNDLE_IDENTIFIER = "com.chenyanjun.${PRODUCT_NAME:rfc1034identifier}"; 486 | PRODUCT_NAME = "$(TARGET_NAME)"; 487 | WRAPPER_EXTENSION = app; 488 | }; 489 | name = Release; 490 | }; 491 | 4B29CFDA19414861009D65CA /* Debug */ = { 492 | isa = XCBuildConfiguration; 493 | buildSettings = { 494 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/ImagePlayerViewDemo.app/ImagePlayerViewDemo"; 495 | FRAMEWORK_SEARCH_PATHS = ( 496 | "$(SDKROOT)/Developer/Library/Frameworks", 497 | "$(inherited)", 498 | "$(DEVELOPER_FRAMEWORKS_DIR)", 499 | ); 500 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 501 | GCC_PREFIX_HEADER = "ImagePlayerViewDemo/ImagePlayerViewDemo-Prefix.pch"; 502 | GCC_PREPROCESSOR_DEFINITIONS = ( 503 | "DEBUG=1", 504 | "$(inherited)", 505 | ); 506 | INFOPLIST_FILE = "ImagePlayerViewDemoTests/ImagePlayerViewDemoTests-Info.plist"; 507 | PRODUCT_BUNDLE_IDENTIFIER = "com.chenyanjun.${PRODUCT_NAME:rfc1034identifier}"; 508 | PRODUCT_NAME = "$(TARGET_NAME)"; 509 | TEST_HOST = "$(BUNDLE_LOADER)"; 510 | WRAPPER_EXTENSION = xctest; 511 | }; 512 | name = Debug; 513 | }; 514 | 4B29CFDB19414861009D65CA /* Release */ = { 515 | isa = XCBuildConfiguration; 516 | buildSettings = { 517 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/ImagePlayerViewDemo.app/ImagePlayerViewDemo"; 518 | FRAMEWORK_SEARCH_PATHS = ( 519 | "$(SDKROOT)/Developer/Library/Frameworks", 520 | "$(inherited)", 521 | "$(DEVELOPER_FRAMEWORKS_DIR)", 522 | ); 523 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 524 | GCC_PREFIX_HEADER = "ImagePlayerViewDemo/ImagePlayerViewDemo-Prefix.pch"; 525 | INFOPLIST_FILE = "ImagePlayerViewDemoTests/ImagePlayerViewDemoTests-Info.plist"; 526 | PRODUCT_BUNDLE_IDENTIFIER = "com.chenyanjun.${PRODUCT_NAME:rfc1034identifier}"; 527 | PRODUCT_NAME = "$(TARGET_NAME)"; 528 | TEST_HOST = "$(BUNDLE_LOADER)"; 529 | WRAPPER_EXTENSION = xctest; 530 | }; 531 | name = Release; 532 | }; 533 | /* End XCBuildConfiguration section */ 534 | 535 | /* Begin XCConfigurationList section */ 536 | 4B29CF9F19414861009D65CA /* Build configuration list for PBXProject "ImagePlayerViewDemo" */ = { 537 | isa = XCConfigurationList; 538 | buildConfigurations = ( 539 | 4B29CFD419414861009D65CA /* Debug */, 540 | 4B29CFD519414861009D65CA /* Release */, 541 | ); 542 | defaultConfigurationIsVisible = 0; 543 | defaultConfigurationName = Release; 544 | }; 545 | 4B29CFD619414861009D65CA /* Build configuration list for PBXNativeTarget "ImagePlayerViewDemo" */ = { 546 | isa = XCConfigurationList; 547 | buildConfigurations = ( 548 | 4B29CFD719414861009D65CA /* Debug */, 549 | 4B29CFD819414861009D65CA /* Release */, 550 | ); 551 | defaultConfigurationIsVisible = 0; 552 | defaultConfigurationName = Release; 553 | }; 554 | 4B29CFD919414861009D65CA /* Build configuration list for PBXNativeTarget "ImagePlayerViewDemoTests" */ = { 555 | isa = XCConfigurationList; 556 | buildConfigurations = ( 557 | 4B29CFDA19414861009D65CA /* Debug */, 558 | 4B29CFDB19414861009D65CA /* Release */, 559 | ); 560 | defaultConfigurationIsVisible = 0; 561 | defaultConfigurationName = Release; 562 | }; 563 | /* End XCConfigurationList section */ 564 | }; 565 | rootObject = 4B29CF9C19414861009D65CA /* Project object */; 566 | } 567 | -------------------------------------------------------------------------------- /Examples/ImagePlayerViewDemo/ImagePlayerViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/ImagePlayerViewDemo/ImagePlayerViewDemo.xcodeproj/xcshareddata/xcschemes/ImagePlayerViewDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 34 | 40 | 41 | 42 | 43 | 44 | 50 | 51 | 52 | 53 | 54 | 55 | 66 | 68 | 74 | 75 | 76 | 77 | 81 | 82 | 83 | 84 | 90 | 92 | 98 | 99 | 100 | 101 | 103 | 104 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /Examples/ImagePlayerViewDemo/ImagePlayerViewDemo/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 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Examples/ImagePlayerViewDemo/ImagePlayerViewDemo/ICAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // ICAppDelegate.h 3 | // ImagePlayerViewDemo 4 | // 5 | // Created by 陈颜俊 on 14-6-6. 6 | // Copyright (c) 2014年 Chenyanjun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ICAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Examples/ImagePlayerViewDemo/ImagePlayerViewDemo/ICAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // ICAppDelegate.m 3 | // ImagePlayerViewDemo 4 | // 5 | // Created by 陈颜俊 on 14-6-6. 6 | // Copyright (c) 2014年 Chenyanjun. All rights reserved. 7 | // 8 | 9 | #import "ICAppDelegate.h" 10 | 11 | @implementation ICAppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // 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. 22 | // 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. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // 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. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 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 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 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 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Examples/ImagePlayerViewDemo/ImagePlayerViewDemo/ICViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ICViewController.h 3 | // ImagePlayerViewDemo 4 | // 5 | // Created by 陈颜俊 on 14-6-6. 6 | // Copyright (c) 2014年 Chenyanjun. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface ICViewController : UIViewController 13 | 14 | @property (weak, nonatomic) IBOutlet ImagePlayerView *imagePlayerView; 15 | @end 16 | -------------------------------------------------------------------------------- /Examples/ImagePlayerViewDemo/ImagePlayerViewDemo/ICViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ICViewController.m 3 | // ImagePlayerViewDemo 4 | // 5 | // Created by 陈颜俊 on 14-6-6. 6 | // Copyright (c) 2014年 Chenyanjun. All rights reserved. 7 | // 8 | 9 | #import "ICViewController.h" 10 | 11 | @interface ICViewController () 12 | @property (nonatomic, strong) NSArray *imageURLs; 13 | @property (nonatomic, strong) NSCache *imageCache; 14 | @end 15 | 16 | @implementation ICViewController 17 | 18 | - (void)viewDidLoad 19 | { 20 | [super viewDidLoad]; 21 | // Do any additional setup after loading the view, typically from a nib. 22 | 23 | _imageCache = [NSCache new]; 24 | 25 | self.imageURLs = @[[NSURL URLWithString:@"http://sudasuta.com/wp-content/uploads/2013/10/10143181686_375e063f2c_z.jpg"], 26 | [NSURL URLWithString:@"http://img01.taopic.com/150920/240455-1509200H31810.jpg"], 27 | [NSURL URLWithString:@"http://img.taopic.com/uploads/allimg/110906/1382-110Z611025585.jpg"]]; 28 | 29 | self.imagePlayerView.imagePlayerViewDelegate = self; 30 | 31 | // set auto scroll interval to x seconds 32 | self.imagePlayerView.scrollInterval = 1.0f; 33 | 34 | // adjust pageControl position 35 | self.imagePlayerView.pageControlPosition = ICPageControlPosition_BottomCenter; 36 | 37 | // hide pageControl or not 38 | self.imagePlayerView.hidePageControl = NO; 39 | 40 | // endless scroll 41 | self.imagePlayerView.endlessScroll = YES; 42 | 43 | // adjust edgeInset 44 | self.imagePlayerView.edgeInsets = UIEdgeInsetsMake(10, 20, 30, 40); 45 | 46 | [self.imagePlayerView reloadData]; 47 | 48 | } 49 | 50 | - (void)didReceiveMemoryWarning 51 | { 52 | [super didReceiveMemoryWarning]; 53 | // Dispose of any resources that can be recreated. 54 | } 55 | 56 | #pragma mark - ImagePlayerViewDelegate 57 | - (NSInteger)numberOfItems 58 | { 59 | return self.imageURLs.count; 60 | } 61 | 62 | - (void)imagePlayerView:(ImagePlayerView *)imagePlayerView loadImageForImageView:(UIImageView *)imageView index:(NSInteger)index 63 | { 64 | // recommend to use SDWebImage lib to load web image 65 | // [imageView setImageWithURL:[self.imageURLs objectAtIndex:index] placeholderImage:nil]; 66 | 67 | NSURL *imageURL = [self.imageURLs objectAtIndex:index]; 68 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ 69 | UIImage *image = [self.imageCache objectForKey:imageURL.absoluteString]; 70 | if (!image) { 71 | NSData *imageData = [NSData dataWithContentsOfURL:imageURL]; 72 | image = [UIImage imageWithData:imageData]; 73 | [self.imageCache setObject:image forKey:imageURL.absoluteString]; 74 | } 75 | dispatch_async(dispatch_get_main_queue(), ^{ 76 | // Update the UI 77 | imageView.image = image; 78 | }); 79 | }); 80 | } 81 | 82 | - (void)imagePlayerView:(ImagePlayerView *)imagePlayerView didTapAtIndex:(NSInteger)index 83 | { 84 | NSLog(@"did tap index = %d", (int)index); 85 | } 86 | @end 87 | -------------------------------------------------------------------------------- /Examples/ImagePlayerViewDemo/ImagePlayerViewDemo/ImagePlayerViewDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | 32 | UIMainStoryboardFile 33 | Main 34 | UIRequiredDeviceCapabilities 35 | 36 | armv7 37 | 38 | UISupportedInterfaceOrientations 39 | 40 | UIInterfaceOrientationPortrait 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Examples/ImagePlayerViewDemo/ImagePlayerViewDemo/ImagePlayerViewDemo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /Examples/ImagePlayerViewDemo/ImagePlayerViewDemo/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 | } -------------------------------------------------------------------------------- /Examples/ImagePlayerViewDemo/ImagePlayerViewDemo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "8.0", 8 | "subtype" : "736h", 9 | "scale" : "3x" 10 | }, 11 | { 12 | "orientation" : "landscape", 13 | "idiom" : "iphone", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "8.0", 16 | "subtype" : "736h", 17 | "scale" : "3x" 18 | }, 19 | { 20 | "orientation" : "portrait", 21 | "idiom" : "iphone", 22 | "extent" : "full-screen", 23 | "minimum-system-version" : "8.0", 24 | "subtype" : "667h", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "orientation" : "portrait", 29 | "idiom" : "iphone", 30 | "extent" : "full-screen", 31 | "minimum-system-version" : "7.0", 32 | "scale" : "2x" 33 | }, 34 | { 35 | "orientation" : "portrait", 36 | "idiom" : "iphone", 37 | "extent" : "full-screen", 38 | "minimum-system-version" : "7.0", 39 | "subtype" : "retina4", 40 | "scale" : "2x" 41 | } 42 | ], 43 | "info" : { 44 | "version" : 1, 45 | "author" : "xcode" 46 | } 47 | } -------------------------------------------------------------------------------- /Examples/ImagePlayerViewDemo/ImagePlayerViewDemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Examples/ImagePlayerViewDemo/ImagePlayerViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ImagePlayerViewDemo 4 | // 5 | // Created by 陈颜俊 on 14-6-6. 6 | // Copyright (c) 2014年 Chenyanjun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "ICAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([ICAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Examples/ImagePlayerViewDemo/ImagePlayerViewDemoTests/ImagePlayerViewDemoTests-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 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Examples/ImagePlayerViewDemo/ImagePlayerViewDemoTests/ImagePlayerViewDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ImagePlayerViewDemoTests.m 3 | // ImagePlayerViewDemoTests 4 | // 5 | // Created by 陈颜俊 on 14-6-6. 6 | // Copyright (c) 2014年 Chenyanjun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ImagePlayerViewDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ImagePlayerViewDemoTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Examples/ImagePlayerViewDemo/ImagePlayerViewDemoTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /ImagePlayerView.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | 4 | s.name = "ImagePlayerView" 5 | s.version = "2.0.3" 6 | s.summary = "Show a group of images in view" 7 | s.description = 'Show a group of images in view, only few code to support. Support UIPageControl, auto scroll.' 8 | 9 | s.homepage = "https://github.com/interchen/ImagePlayerView" 10 | s.screenshots = "https://github.com/interchen/ImagePlayerView/blob/master/endless.gif" 11 | 12 | s.license = 'MIT' 13 | 14 | s.author = { "Chen Yanjun" => "inter.chen@gmail.com" } 15 | s.social_media_url = "https://twitter.com/azhunchen" 16 | 17 | s.ios.deployment_target = '6.0' 18 | 19 | s.source = { :git => "https://github.com/interchen/ImagePlayerView.git", :tag => s.version } 20 | s.source_files = 'ImagePlayerView/*.{h,m}' 21 | 22 | s.requires_arc = true 23 | 24 | end 25 | -------------------------------------------------------------------------------- /ImagePlayerView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4B6F44E919402114003A88A8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B6F44E819402114003A88A8 /* Foundation.framework */; }; 11 | 4B6F44EE19402114003A88A8 /* ImagePlayerView.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B6F44ED19402114003A88A8 /* ImagePlayerView.h */; }; 12 | 4B6F44F019402114003A88A8 /* ImagePlayerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6F44EF19402114003A88A8 /* ImagePlayerView.m */; }; 13 | 4B6F44F719402114003A88A8 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B6F44F619402114003A88A8 /* XCTest.framework */; }; 14 | 4B6F44F819402114003A88A8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B6F44E819402114003A88A8 /* Foundation.framework */; }; 15 | 4B6F44FA19402114003A88A8 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B6F44F919402114003A88A8 /* UIKit.framework */; }; 16 | 4B6F44FD19402114003A88A8 /* libImagePlayerView.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B6F44E519402114003A88A8 /* libImagePlayerView.a */; }; 17 | 4B6F450319402114003A88A8 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4B6F450119402114003A88A8 /* InfoPlist.strings */; }; 18 | 4B6F450519402114003A88A8 /* ImagePlayerViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6F450419402114003A88A8 /* ImagePlayerViewTests.m */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 4B6F44FB19402114003A88A8 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 4B6F44DD19402114003A88A8 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 4B6F44E419402114003A88A8; 27 | remoteInfo = ImagePlayerView; 28 | }; 29 | /* End PBXContainerItemProxy section */ 30 | 31 | /* Begin PBXCopyFilesBuildPhase section */ 32 | 4B6F44E319402114003A88A8 /* CopyFiles */ = { 33 | isa = PBXCopyFilesBuildPhase; 34 | buildActionMask = 2147483647; 35 | dstPath = "include/$(PRODUCT_NAME)"; 36 | dstSubfolderSpec = 16; 37 | files = ( 38 | 4B6F44EE19402114003A88A8 /* ImagePlayerView.h in CopyFiles */, 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXCopyFilesBuildPhase section */ 43 | 44 | /* Begin PBXFileReference section */ 45 | 4B6F44E519402114003A88A8 /* libImagePlayerView.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libImagePlayerView.a; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 4B6F44E819402114003A88A8 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 47 | 4B6F44EC19402114003A88A8 /* ImagePlayerView-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ImagePlayerView-Prefix.pch"; sourceTree = ""; }; 48 | 4B6F44ED19402114003A88A8 /* ImagePlayerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImagePlayerView.h; sourceTree = ""; }; 49 | 4B6F44EF19402114003A88A8 /* ImagePlayerView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ImagePlayerView.m; sourceTree = ""; }; 50 | 4B6F44F519402114003A88A8 /* ImagePlayerViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ImagePlayerViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 4B6F44F619402114003A88A8 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 52 | 4B6F44F919402114003A88A8 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; 53 | 4B6F450019402114003A88A8 /* ImagePlayerViewTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ImagePlayerViewTests-Info.plist"; sourceTree = ""; }; 54 | 4B6F450219402114003A88A8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 55 | 4B6F450419402114003A88A8 /* ImagePlayerViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ImagePlayerViewTests.m; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 4B6F44E219402114003A88A8 /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | 4B6F44E919402114003A88A8 /* Foundation.framework in Frameworks */, 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | 4B6F44F219402114003A88A8 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | 4B6F44F719402114003A88A8 /* XCTest.framework in Frameworks */, 72 | 4B6F44FD19402114003A88A8 /* libImagePlayerView.a in Frameworks */, 73 | 4B6F44FA19402114003A88A8 /* UIKit.framework in Frameworks */, 74 | 4B6F44F819402114003A88A8 /* Foundation.framework in Frameworks */, 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | /* End PBXFrameworksBuildPhase section */ 79 | 80 | /* Begin PBXGroup section */ 81 | 4B6F44DC19402114003A88A8 = { 82 | isa = PBXGroup; 83 | children = ( 84 | 4B6F44EA19402114003A88A8 /* ImagePlayerView */, 85 | 4B6F44FE19402114003A88A8 /* ImagePlayerViewTests */, 86 | 4B6F44E719402114003A88A8 /* Frameworks */, 87 | 4B6F44E619402114003A88A8 /* Products */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | 4B6F44E619402114003A88A8 /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 4B6F44E519402114003A88A8 /* libImagePlayerView.a */, 95 | 4B6F44F519402114003A88A8 /* ImagePlayerViewTests.xctest */, 96 | ); 97 | name = Products; 98 | sourceTree = ""; 99 | }; 100 | 4B6F44E719402114003A88A8 /* Frameworks */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 4B6F44E819402114003A88A8 /* Foundation.framework */, 104 | 4B6F44F619402114003A88A8 /* XCTest.framework */, 105 | 4B6F44F919402114003A88A8 /* UIKit.framework */, 106 | ); 107 | name = Frameworks; 108 | sourceTree = ""; 109 | }; 110 | 4B6F44EA19402114003A88A8 /* ImagePlayerView */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 4B6F44ED19402114003A88A8 /* ImagePlayerView.h */, 114 | 4B6F44EF19402114003A88A8 /* ImagePlayerView.m */, 115 | 4B6F44EB19402114003A88A8 /* Supporting Files */, 116 | ); 117 | path = ImagePlayerView; 118 | sourceTree = ""; 119 | }; 120 | 4B6F44EB19402114003A88A8 /* Supporting Files */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 4B6F44EC19402114003A88A8 /* ImagePlayerView-Prefix.pch */, 124 | ); 125 | name = "Supporting Files"; 126 | sourceTree = ""; 127 | }; 128 | 4B6F44FE19402114003A88A8 /* ImagePlayerViewTests */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | 4B6F450419402114003A88A8 /* ImagePlayerViewTests.m */, 132 | 4B6F44FF19402114003A88A8 /* Supporting Files */, 133 | ); 134 | path = ImagePlayerViewTests; 135 | sourceTree = ""; 136 | }; 137 | 4B6F44FF19402114003A88A8 /* Supporting Files */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 4B6F450019402114003A88A8 /* ImagePlayerViewTests-Info.plist */, 141 | 4B6F450119402114003A88A8 /* InfoPlist.strings */, 142 | ); 143 | name = "Supporting Files"; 144 | sourceTree = ""; 145 | }; 146 | /* End PBXGroup section */ 147 | 148 | /* Begin PBXNativeTarget section */ 149 | 4B6F44E419402114003A88A8 /* ImagePlayerView */ = { 150 | isa = PBXNativeTarget; 151 | buildConfigurationList = 4B6F450819402114003A88A8 /* Build configuration list for PBXNativeTarget "ImagePlayerView" */; 152 | buildPhases = ( 153 | 4B6F44E119402114003A88A8 /* Sources */, 154 | 4B6F44E219402114003A88A8 /* Frameworks */, 155 | 4B6F44E319402114003A88A8 /* CopyFiles */, 156 | ); 157 | buildRules = ( 158 | ); 159 | dependencies = ( 160 | ); 161 | name = ImagePlayerView; 162 | productName = ImagePlayerView; 163 | productReference = 4B6F44E519402114003A88A8 /* libImagePlayerView.a */; 164 | productType = "com.apple.product-type.library.static"; 165 | }; 166 | 4B6F44F419402114003A88A8 /* ImagePlayerViewTests */ = { 167 | isa = PBXNativeTarget; 168 | buildConfigurationList = 4B6F450B19402114003A88A8 /* Build configuration list for PBXNativeTarget "ImagePlayerViewTests" */; 169 | buildPhases = ( 170 | 4B6F44F119402114003A88A8 /* Sources */, 171 | 4B6F44F219402114003A88A8 /* Frameworks */, 172 | 4B6F44F319402114003A88A8 /* Resources */, 173 | ); 174 | buildRules = ( 175 | ); 176 | dependencies = ( 177 | 4B6F44FC19402114003A88A8 /* PBXTargetDependency */, 178 | ); 179 | name = ImagePlayerViewTests; 180 | productName = ImagePlayerViewTests; 181 | productReference = 4B6F44F519402114003A88A8 /* ImagePlayerViewTests.xctest */; 182 | productType = "com.apple.product-type.bundle.unit-test"; 183 | }; 184 | /* End PBXNativeTarget section */ 185 | 186 | /* Begin PBXProject section */ 187 | 4B6F44DD19402114003A88A8 /* Project object */ = { 188 | isa = PBXProject; 189 | attributes = { 190 | LastUpgradeCheck = 0730; 191 | ORGANIZATIONNAME = Chenyanjun; 192 | }; 193 | buildConfigurationList = 4B6F44E019402114003A88A8 /* Build configuration list for PBXProject "ImagePlayerView" */; 194 | compatibilityVersion = "Xcode 3.2"; 195 | developmentRegion = English; 196 | hasScannedForEncodings = 0; 197 | knownRegions = ( 198 | en, 199 | ); 200 | mainGroup = 4B6F44DC19402114003A88A8; 201 | productRefGroup = 4B6F44E619402114003A88A8 /* Products */; 202 | projectDirPath = ""; 203 | projectRoot = ""; 204 | targets = ( 205 | 4B6F44E419402114003A88A8 /* ImagePlayerView */, 206 | 4B6F44F419402114003A88A8 /* ImagePlayerViewTests */, 207 | ); 208 | }; 209 | /* End PBXProject section */ 210 | 211 | /* Begin PBXResourcesBuildPhase section */ 212 | 4B6F44F319402114003A88A8 /* Resources */ = { 213 | isa = PBXResourcesBuildPhase; 214 | buildActionMask = 2147483647; 215 | files = ( 216 | 4B6F450319402114003A88A8 /* InfoPlist.strings in Resources */, 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | }; 220 | /* End PBXResourcesBuildPhase section */ 221 | 222 | /* Begin PBXSourcesBuildPhase section */ 223 | 4B6F44E119402114003A88A8 /* Sources */ = { 224 | isa = PBXSourcesBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | 4B6F44F019402114003A88A8 /* ImagePlayerView.m in Sources */, 228 | ); 229 | runOnlyForDeploymentPostprocessing = 0; 230 | }; 231 | 4B6F44F119402114003A88A8 /* Sources */ = { 232 | isa = PBXSourcesBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | 4B6F450519402114003A88A8 /* ImagePlayerViewTests.m in Sources */, 236 | ); 237 | runOnlyForDeploymentPostprocessing = 0; 238 | }; 239 | /* End PBXSourcesBuildPhase section */ 240 | 241 | /* Begin PBXTargetDependency section */ 242 | 4B6F44FC19402114003A88A8 /* PBXTargetDependency */ = { 243 | isa = PBXTargetDependency; 244 | target = 4B6F44E419402114003A88A8 /* ImagePlayerView */; 245 | targetProxy = 4B6F44FB19402114003A88A8 /* PBXContainerItemProxy */; 246 | }; 247 | /* End PBXTargetDependency section */ 248 | 249 | /* Begin PBXVariantGroup section */ 250 | 4B6F450119402114003A88A8 /* InfoPlist.strings */ = { 251 | isa = PBXVariantGroup; 252 | children = ( 253 | 4B6F450219402114003A88A8 /* en */, 254 | ); 255 | name = InfoPlist.strings; 256 | sourceTree = ""; 257 | }; 258 | /* End PBXVariantGroup section */ 259 | 260 | /* Begin XCBuildConfiguration section */ 261 | 4B6F450619402114003A88A8 /* Debug */ = { 262 | isa = XCBuildConfiguration; 263 | buildSettings = { 264 | ALWAYS_SEARCH_USER_PATHS = NO; 265 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 266 | CLANG_CXX_LIBRARY = "libc++"; 267 | CLANG_ENABLE_MODULES = YES; 268 | CLANG_ENABLE_OBJC_ARC = YES; 269 | CLANG_WARN_BOOL_CONVERSION = YES; 270 | CLANG_WARN_CONSTANT_CONVERSION = YES; 271 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 272 | CLANG_WARN_EMPTY_BODY = YES; 273 | CLANG_WARN_ENUM_CONVERSION = YES; 274 | CLANG_WARN_INT_CONVERSION = YES; 275 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 276 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 277 | COPY_PHASE_STRIP = NO; 278 | ENABLE_TESTABILITY = YES; 279 | GCC_C_LANGUAGE_STANDARD = gnu99; 280 | GCC_DYNAMIC_NO_PIC = NO; 281 | GCC_OPTIMIZATION_LEVEL = 0; 282 | GCC_PREPROCESSOR_DEFINITIONS = ( 283 | "DEBUG=1", 284 | "$(inherited)", 285 | ); 286 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 287 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 288 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 289 | GCC_WARN_UNDECLARED_SELECTOR = YES; 290 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 291 | GCC_WARN_UNUSED_FUNCTION = YES; 292 | GCC_WARN_UNUSED_VARIABLE = YES; 293 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 294 | ONLY_ACTIVE_ARCH = YES; 295 | SDKROOT = iphoneos; 296 | }; 297 | name = Debug; 298 | }; 299 | 4B6F450719402114003A88A8 /* Release */ = { 300 | isa = XCBuildConfiguration; 301 | buildSettings = { 302 | ALWAYS_SEARCH_USER_PATHS = NO; 303 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 304 | CLANG_CXX_LIBRARY = "libc++"; 305 | CLANG_ENABLE_MODULES = YES; 306 | CLANG_ENABLE_OBJC_ARC = YES; 307 | CLANG_WARN_BOOL_CONVERSION = YES; 308 | CLANG_WARN_CONSTANT_CONVERSION = YES; 309 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 310 | CLANG_WARN_EMPTY_BODY = YES; 311 | CLANG_WARN_ENUM_CONVERSION = YES; 312 | CLANG_WARN_INT_CONVERSION = YES; 313 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 314 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 315 | COPY_PHASE_STRIP = YES; 316 | ENABLE_NS_ASSERTIONS = NO; 317 | GCC_C_LANGUAGE_STANDARD = gnu99; 318 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 319 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 320 | GCC_WARN_UNDECLARED_SELECTOR = YES; 321 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 322 | GCC_WARN_UNUSED_FUNCTION = YES; 323 | GCC_WARN_UNUSED_VARIABLE = YES; 324 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 325 | SDKROOT = iphoneos; 326 | VALIDATE_PRODUCT = YES; 327 | }; 328 | name = Release; 329 | }; 330 | 4B6F450919402114003A88A8 /* Debug */ = { 331 | isa = XCBuildConfiguration; 332 | buildSettings = { 333 | DSTROOT = /tmp/ImagePlayerView.dst; 334 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 335 | GCC_PREFIX_HEADER = "ImagePlayerView/ImagePlayerView-Prefix.pch"; 336 | HEADER_SEARCH_PATHS = ( 337 | "$(inherited)", 338 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 339 | "\"$(OBJROOT)/UninstalledProducts/include\"", 340 | "\"$(TARGET_BUILD_DIR)/usr/local/lib/include\"", 341 | ); 342 | OTHER_LDFLAGS = "-ObjC"; 343 | PRODUCT_NAME = "$(TARGET_NAME)"; 344 | SKIP_INSTALL = YES; 345 | }; 346 | name = Debug; 347 | }; 348 | 4B6F450A19402114003A88A8 /* Release */ = { 349 | isa = XCBuildConfiguration; 350 | buildSettings = { 351 | DSTROOT = /tmp/ImagePlayerView.dst; 352 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 353 | GCC_PREFIX_HEADER = "ImagePlayerView/ImagePlayerView-Prefix.pch"; 354 | HEADER_SEARCH_PATHS = ( 355 | "$(inherited)", 356 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 357 | "\"$(OBJROOT)/UninstalledProducts/include\"", 358 | "\"$(TARGET_BUILD_DIR)/usr/local/lib/include\"", 359 | ); 360 | OTHER_LDFLAGS = "-ObjC"; 361 | PRODUCT_NAME = "$(TARGET_NAME)"; 362 | SKIP_INSTALL = YES; 363 | }; 364 | name = Release; 365 | }; 366 | 4B6F450C19402114003A88A8 /* Debug */ = { 367 | isa = XCBuildConfiguration; 368 | buildSettings = { 369 | FRAMEWORK_SEARCH_PATHS = ( 370 | "$(SDKROOT)/Developer/Library/Frameworks", 371 | "$(inherited)", 372 | "$(DEVELOPER_FRAMEWORKS_DIR)", 373 | ); 374 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 375 | GCC_PREFIX_HEADER = "ImagePlayerView/ImagePlayerView-Prefix.pch"; 376 | GCC_PREPROCESSOR_DEFINITIONS = ( 377 | "DEBUG=1", 378 | "$(inherited)", 379 | ); 380 | INFOPLIST_FILE = "ImagePlayerViewTests/ImagePlayerViewTests-Info.plist"; 381 | PRODUCT_BUNDLE_IDENTIFIER = "com.chenyanjun.${PRODUCT_NAME:rfc1034identifier}"; 382 | PRODUCT_NAME = "$(TARGET_NAME)"; 383 | WRAPPER_EXTENSION = xctest; 384 | }; 385 | name = Debug; 386 | }; 387 | 4B6F450D19402114003A88A8 /* Release */ = { 388 | isa = XCBuildConfiguration; 389 | buildSettings = { 390 | FRAMEWORK_SEARCH_PATHS = ( 391 | "$(SDKROOT)/Developer/Library/Frameworks", 392 | "$(inherited)", 393 | "$(DEVELOPER_FRAMEWORKS_DIR)", 394 | ); 395 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 396 | GCC_PREFIX_HEADER = "ImagePlayerView/ImagePlayerView-Prefix.pch"; 397 | INFOPLIST_FILE = "ImagePlayerViewTests/ImagePlayerViewTests-Info.plist"; 398 | PRODUCT_BUNDLE_IDENTIFIER = "com.chenyanjun.${PRODUCT_NAME:rfc1034identifier}"; 399 | PRODUCT_NAME = "$(TARGET_NAME)"; 400 | WRAPPER_EXTENSION = xctest; 401 | }; 402 | name = Release; 403 | }; 404 | /* End XCBuildConfiguration section */ 405 | 406 | /* Begin XCConfigurationList section */ 407 | 4B6F44E019402114003A88A8 /* Build configuration list for PBXProject "ImagePlayerView" */ = { 408 | isa = XCConfigurationList; 409 | buildConfigurations = ( 410 | 4B6F450619402114003A88A8 /* Debug */, 411 | 4B6F450719402114003A88A8 /* Release */, 412 | ); 413 | defaultConfigurationIsVisible = 0; 414 | defaultConfigurationName = Release; 415 | }; 416 | 4B6F450819402114003A88A8 /* Build configuration list for PBXNativeTarget "ImagePlayerView" */ = { 417 | isa = XCConfigurationList; 418 | buildConfigurations = ( 419 | 4B6F450919402114003A88A8 /* Debug */, 420 | 4B6F450A19402114003A88A8 /* Release */, 421 | ); 422 | defaultConfigurationIsVisible = 0; 423 | defaultConfigurationName = Release; 424 | }; 425 | 4B6F450B19402114003A88A8 /* Build configuration list for PBXNativeTarget "ImagePlayerViewTests" */ = { 426 | isa = XCConfigurationList; 427 | buildConfigurations = ( 428 | 4B6F450C19402114003A88A8 /* Debug */, 429 | 4B6F450D19402114003A88A8 /* Release */, 430 | ); 431 | defaultConfigurationIsVisible = 0; 432 | defaultConfigurationName = Release; 433 | }; 434 | /* End XCConfigurationList section */ 435 | }; 436 | rootObject = 4B6F44DD19402114003A88A8 /* Project object */; 437 | } 438 | -------------------------------------------------------------------------------- /ImagePlayerView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ImagePlayerView.xcodeproj/xcshareddata/xcschemes/ImagePlayerView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 55 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 74 | 76 | 77 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /ImagePlayerView.xcodeproj/xcuserdata/chenyanjun.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ImagePlayerView.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4B6F44E419402114003A88A8 16 | 17 | primary 18 | 19 | 20 | 4B6F44F419402114003A88A8 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ImagePlayerView/ImagePlayerView-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /ImagePlayerView/ImagePlayerView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ImagePlayerView.h 3 | // ImagePlayerView 4 | // 5 | // Created by 陈颜俊 on 14-6-5. 6 | // Copyright (c) 2014年 Chenyanjun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger, ICPageControlPosition) { 12 | ICPageControlPosition_TopLeft, 13 | ICPageControlPosition_TopCenter, 14 | ICPageControlPosition_TopRight, 15 | ICPageControlPosition_BottomLeft, 16 | ICPageControlPosition_BottomCenter, 17 | ICPageControlPosition_BottomRight 18 | }; 19 | 20 | @protocol ImagePlayerViewDelegate; 21 | 22 | @interface ImagePlayerView : UIView 23 | @property (nonatomic, weak) id imagePlayerViewDelegate; 24 | @property (nonatomic, strong) UIPageControl *pageControl; 25 | @property (nonatomic, assign) NSUInteger scrollInterval; // scroll interval, unit: second, default is 2 seconds. set 0 to close auto scroll feature 26 | @property (nonatomic, assign) ICPageControlPosition pageControlPosition; // pageControl position, defautl is bottomright 27 | @property (nonatomic, assign) BOOL hidePageControl; // hide pageControl, default is NO 28 | @property (nonatomic, assign) UIEdgeInsets edgeInsets; 29 | @property (nonatomic, assign) BOOL endlessScroll; // endless scroll, default is NO 30 | 31 | /** 32 | * Reload everything 33 | */ 34 | - (void)reloadData; 35 | 36 | /** 37 | * Stop timer before your view controller is poped 38 | */ 39 | - (void)stopTimer; 40 | 41 | @end 42 | 43 | #pragma mark - ImagePlayerViewDelegate 44 | @protocol ImagePlayerViewDelegate 45 | 46 | @required 47 | /** 48 | * Number of items 49 | * 50 | * @return Number of items 51 | */ 52 | - (NSInteger)numberOfItems; 53 | 54 | /** 55 | * Init imageview 56 | * 57 | * @param imagePlayerView ImagePlayerView object 58 | * @param imageView UIImageView object 59 | * @param index index of imageview 60 | */ 61 | - (void)imagePlayerView:(ImagePlayerView *)imagePlayerView loadImageForImageView:(UIImageView *)imageView index:(NSInteger)index; 62 | 63 | @optional 64 | 65 | /** 66 | * Tap ImageView action 67 | * 68 | * @param imagePlayerView ImagePlayerView object 69 | * @param index index of imageview 70 | */ 71 | - (void)imagePlayerView:(ImagePlayerView *)imagePlayerView didTapAtIndex:(NSInteger)index; 72 | 73 | /** 74 | * Scroll ImageView action 75 | * @param imagePlayerView ImagePlayerView object 76 | * @param index current index 77 | **/ 78 | - (void)imagePlayerView:(ImagePlayerView *)imagePlayerView didScorllIndex:(NSInteger)index; 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /ImagePlayerView/ImagePlayerView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ImagePlayerView.m 3 | // ImagePlayerView 4 | // 5 | // Created by 陈颜俊 on 14-6-5. 6 | // Copyright (c) 2014年 Chenyanjun. All rights reserved. 7 | // 8 | 9 | #import "ImagePlayerView.h" 10 | 11 | #define kDefaultScrollInterval 2 12 | #define kCellIdentifier @"ImagePlayerViewCell" 13 | 14 | 15 | #pragma mark - Category RemoveConstraints 16 | // refer from @marchinram http://stackoverflow.com/questions/24418884/remove-all-constraints-affecting-a-uiview 17 | @interface UIView (RemoveConstraints) 18 | - (void)removeAllConstraints; 19 | @end 20 | 21 | @implementation UIView (RemoveConstraints) 22 | - (void)removeAllConstraints 23 | { 24 | UIView *superview = self.superview; 25 | while (superview != nil) { 26 | for (NSLayoutConstraint *c in superview.constraints) { 27 | if (c.firstItem == self || c.secondItem == self) { 28 | [superview removeConstraint:c]; 29 | } 30 | } 31 | superview = superview.superview; 32 | } 33 | 34 | [self removeConstraints:self.constraints]; 35 | } 36 | @end 37 | 38 | #pragma mark - ImagePlayerViewCell 39 | @interface ImagePlayerViewCell : UICollectionViewCell 40 | @property (nonatomic, strong) UIImageView *imageView; 41 | @end 42 | 43 | @implementation ImagePlayerViewCell 44 | 45 | - (instancetype)initWithFrame:(CGRect)frame 46 | { 47 | self = [super initWithFrame:frame]; 48 | { 49 | self.imageView = [[UIImageView alloc] init]; 50 | self.imageView.contentMode = UIViewContentModeScaleToFill; 51 | self.imageView.userInteractionEnabled = YES; 52 | self.imageView.translatesAutoresizingMaskIntoConstraints = NO; 53 | 54 | [self.contentView addSubview:self.imageView]; 55 | 56 | // fill cell 57 | [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[imageView]-0-|" options:kNilOptions metrics:0 views:@{@"imageView": self.imageView}]]; 58 | [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[imageView]-0-|" options:kNilOptions metrics:0 views:@{@"imageView": self.imageView}]]; 59 | } 60 | return self; 61 | } 62 | @end 63 | 64 | #pragma mark - ImagePlayerView 65 | @interface ImagePlayerView() 66 | @property (nonatomic, strong) UICollectionView *collectionView; 67 | @property (nonatomic, assign) NSInteger count; 68 | @property (nonatomic, strong) NSTimer *autoScrollTimer; 69 | @end 70 | 71 | @implementation ImagePlayerView 72 | 73 | #pragma mark - init 74 | - (id)initWithFrame:(CGRect)frame 75 | { 76 | self = [super initWithFrame:frame]; 77 | if (self) { 78 | [self _init]; 79 | } 80 | return self; 81 | } 82 | 83 | - (id)initWithCoder:(NSCoder *)aDecoder 84 | { 85 | self = [super initWithCoder:aDecoder]; 86 | if (self) { 87 | [self _init]; 88 | } 89 | return self; 90 | } 91 | 92 | - (id)initWithDelegate:(id)delegate 93 | { 94 | self = [super init]; 95 | if (self) { 96 | self.imagePlayerViewDelegate = delegate; 97 | [self _init]; 98 | } 99 | return self; 100 | } 101 | 102 | - (void)dealloc 103 | { 104 | [self removeObserver:self forKeyPath:@"bounds"]; 105 | 106 | if (self.autoScrollTimer) { 107 | [self.autoScrollTimer invalidate]; 108 | self.autoScrollTimer = nil; 109 | } 110 | self.collectionView.delegate = nil; 111 | self.collectionView.dataSource = nil; 112 | self.imagePlayerViewDelegate = nil; 113 | } 114 | 115 | - (void)_init 116 | { 117 | [self addObserver:self forKeyPath:@"bounds" options:NSKeyValueObservingOptionNew context:NULL]; 118 | 119 | [self setupCollectionView]; 120 | [self setupPageControl]; 121 | 122 | // default settings 123 | self.scrollInterval = kDefaultScrollInterval; 124 | self.pageControlPosition = ICPageControlPosition_BottomRight; 125 | self.edgeInsets = UIEdgeInsetsZero; 126 | 127 | [self reloadData]; 128 | } 129 | 130 | - (void)setupCollectionView { 131 | if (!self.collectionView) { 132 | UICollectionViewFlowLayout *layout = [UICollectionViewFlowLayout new]; 133 | layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; 134 | layout.minimumInteritemSpacing = 0; 135 | layout.minimumLineSpacing = 0; 136 | 137 | self.collectionView = [[UICollectionView alloc] initWithFrame:self.bounds collectionViewLayout:layout]; 138 | self.collectionView.backgroundColor = [UIColor whiteColor]; 139 | 140 | self.collectionView.translatesAutoresizingMaskIntoConstraints = NO; 141 | self.collectionView.pagingEnabled = YES; 142 | self.collectionView.bounces = NO; 143 | self.collectionView.showsHorizontalScrollIndicator = NO; 144 | self.collectionView.showsVerticalScrollIndicator = NO; 145 | self.collectionView.scrollsToTop = NO; 146 | 147 | [self.collectionView registerClass:[ImagePlayerViewCell class] forCellWithReuseIdentifier:kCellIdentifier]; 148 | 149 | self.collectionView.delegate = self; 150 | self.collectionView.dataSource = self; 151 | 152 | [self addSubview:self.collectionView]; 153 | } 154 | } 155 | 156 | - (void)setupPageControl { 157 | if (!self.pageControl) { 158 | self.pageControl = [[UIPageControl alloc] init]; 159 | } 160 | self.pageControl.userInteractionEnabled = YES; 161 | self.pageControl.translatesAutoresizingMaskIntoConstraints = NO; 162 | self.pageControl.numberOfPages = self.count; 163 | self.pageControl.currentPage = 0; 164 | [self.pageControl addTarget:self action:@selector(handleClickPageControl:) forControlEvents:UIControlEventTouchUpInside]; 165 | [self addSubview:self.pageControl]; 166 | } 167 | 168 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context 169 | { 170 | if ([keyPath isEqualToString:@"bounds"]) { 171 | [self reloadData]; 172 | } 173 | } 174 | 175 | - (void)reloadData 176 | { 177 | self.count = [self.imagePlayerViewDelegate numberOfItems]; 178 | 179 | self.pageControl.numberOfPages = self.count; 180 | 181 | [self.collectionView reloadData]; 182 | } 183 | 184 | #pragma mark UICollectionView delegate 185 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section 186 | { 187 | NSInteger itemCount = self.count; 188 | if (self.endlessScroll) { 189 | itemCount += 1; 190 | } 191 | return itemCount; 192 | } 193 | 194 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 195 | { 196 | ImagePlayerViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kCellIdentifier forIndexPath:indexPath]; 197 | 198 | // check if reused 199 | BOOL isReused = cell.tag != indexPath.row; 200 | if ((indexPath.row == 0 || indexPath.row == self.count)) { 201 | // for endless scroll, the first one is the same as the last one 202 | // so don't clear image or there will be a short time blank 203 | isReused = false; 204 | } 205 | if (isReused) { 206 | cell.imageView.image = nil; 207 | } 208 | 209 | cell.tag = indexPath.row; 210 | 211 | NSInteger index = indexPath.row; 212 | if (index == self.count) { 213 | index = 0; 214 | } 215 | [self.imagePlayerViewDelegate imagePlayerView:self loadImageForImageView:cell.imageView index:index]; 216 | 217 | return cell; 218 | } 219 | 220 | - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath 221 | { 222 | NSInteger index = indexPath.row; 223 | if (index == self.count) { 224 | index = 0; 225 | } 226 | 227 | if (self.imagePlayerViewDelegate && [self.imagePlayerViewDelegate respondsToSelector:@selector(imagePlayerView:didTapAtIndex:)]) { 228 | [self.imagePlayerViewDelegate imagePlayerView:self didTapAtIndex:index]; 229 | } 230 | } 231 | 232 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath 233 | { 234 | return collectionView.bounds.size; 235 | } 236 | 237 | #pragma mark - actions 238 | - (void)handleClickPageControl:(UIPageControl *)sender 239 | { 240 | [self restartTimer]; 241 | 242 | if (sender.currentPage >= [self.collectionView numberOfItemsInSection:0]) { 243 | return; 244 | } 245 | 246 | [self.collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForRow:sender.currentPage inSection:0] 247 | atScrollPosition:UICollectionViewScrollPositionNone 248 | animated:YES]; 249 | } 250 | 251 | #pragma mark - auto scroll timer 252 | - (void)setScrollInterval:(NSUInteger)scrollInterval 253 | { 254 | _scrollInterval = scrollInterval; 255 | [self restartTimer]; 256 | } 257 | 258 | - (void)handleScrollTimer:(NSTimer *)timer 259 | { 260 | if (self.count == 0) { 261 | return; 262 | } 263 | 264 | NSInteger currentPage = self.pageControl.currentPage; 265 | NSInteger nextPage = currentPage + 1; 266 | if (self.endlessScroll 267 | && nextPage == self.count + 1) { 268 | nextPage = 0; 269 | } 270 | 271 | if (nextPage >= [self.collectionView numberOfItemsInSection:0]) { 272 | return; 273 | } 274 | 275 | NSIndexPath *indexPath = [NSIndexPath indexPathForRow:nextPage inSection:0]; 276 | [self.collectionView scrollToItemAtIndexPath:indexPath 277 | atScrollPosition:UICollectionViewScrollPositionNone 278 | animated:YES]; 279 | } 280 | 281 | #pragma mark - scroll delegate 282 | - (void)scrollViewDidEndScrollingAnimation:(UICollectionView *)collectionView 283 | { 284 | [self didEndScroll:collectionView]; 285 | } 286 | 287 | - (void)scrollViewDidEndDecelerating:(UICollectionView *)collectionView 288 | { 289 | [self didEndScroll:collectionView]; 290 | } 291 | 292 | - (void)didEndScroll:(UICollectionView *)collectionView 293 | { 294 | // when user scrolls manually, stop timer and start timer again to avoid scrolling to next immediatelly 295 | if (self.scrollInterval > 0) { 296 | [self restartTimer]; 297 | } 298 | 299 | // update UIPageControl 300 | NSInteger currentIndex = collectionView.contentOffset.x / collectionView.bounds.size.width; 301 | if (currentIndex == self.count) { 302 | // delay 0.1s or there will be a short time blank 303 | [self performSelector:@selector(scrollToFirstItem) withObject:nil afterDelay:0.1]; 304 | 305 | currentIndex = 0; 306 | } 307 | 308 | if (self.imagePlayerViewDelegate && [self.imagePlayerViewDelegate respondsToSelector:@selector(imagePlayerView:didScorllIndex:)]) { 309 | [self.imagePlayerViewDelegate imagePlayerView:self didScorllIndex:currentIndex]; 310 | } 311 | 312 | self.pageControl.currentPage = currentIndex; 313 | } 314 | 315 | - (void)scrollToFirstItem { 316 | [self.collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] 317 | atScrollPosition:UICollectionViewScrollPositionNone 318 | animated:NO]; 319 | } 320 | 321 | #pragma mark - settings 322 | - (void)restartTimer { 323 | if (self.autoScrollTimer && self.autoScrollTimer.isValid) { 324 | [self.autoScrollTimer invalidate]; 325 | self.autoScrollTimer = nil; 326 | } 327 | 328 | if (self.scrollInterval > 0) { 329 | self.autoScrollTimer = [NSTimer scheduledTimerWithTimeInterval:self.scrollInterval target:self selector:@selector(handleScrollTimer:) userInfo:nil repeats:YES]; 330 | } 331 | } 332 | 333 | - (void)setPageControlPosition:(ICPageControlPosition)pageControlPosition 334 | { 335 | NSString *vFormat = nil; 336 | NSString *hFormat = nil; 337 | 338 | switch (pageControlPosition) { 339 | case ICPageControlPosition_TopLeft: { 340 | vFormat = @"V:|-0-[pageControl]"; 341 | hFormat = @"H:|-[pageControl]"; 342 | break; 343 | } 344 | 345 | case ICPageControlPosition_TopCenter: { 346 | vFormat = @"V:|-0-[pageControl]"; 347 | hFormat = @"H:|[pageControl]|"; 348 | break; 349 | } 350 | 351 | case ICPageControlPosition_TopRight: { 352 | vFormat = @"V:|-0-[pageControl]"; 353 | hFormat = @"H:[pageControl]-|"; 354 | break; 355 | } 356 | 357 | case ICPageControlPosition_BottomLeft: { 358 | vFormat = @"V:[pageControl]-0-|"; 359 | hFormat = @"H:|-[pageControl]"; 360 | break; 361 | } 362 | 363 | case ICPageControlPosition_BottomCenter: { 364 | vFormat = @"V:[pageControl]-0-|"; 365 | hFormat = @"H:|[pageControl]|"; 366 | break; 367 | } 368 | 369 | case ICPageControlPosition_BottomRight: { 370 | vFormat = @"V:[pageControl]-0-|"; 371 | hFormat = @"H:[pageControl]-|"; 372 | break; 373 | } 374 | 375 | default: 376 | break; 377 | } 378 | 379 | [self.pageControl removeAllConstraints]; 380 | 381 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:vFormat 382 | options:kNilOptions 383 | metrics:nil 384 | views:@{@"pageControl": self.pageControl}]]; 385 | 386 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:hFormat 387 | options:kNilOptions 388 | metrics:nil 389 | views:@{@"pageControl": self.pageControl}]]; 390 | } 391 | 392 | - (void)setHidePageControl:(BOOL)hidePageControl 393 | { 394 | self.pageControl.hidden = hidePageControl; 395 | } 396 | 397 | - (void)setEdgeInsets:(UIEdgeInsets)edgeInsets 398 | { 399 | _edgeInsets = edgeInsets; 400 | 401 | [self.collectionView removeAllConstraints]; 402 | 403 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-top-[collectionView]-bottom-|" 404 | options:kNilOptions 405 | metrics:@{@"top": @(self.edgeInsets.top), 406 | @"bottom": @(self.edgeInsets.bottom)} 407 | views:@{@"collectionView": self.collectionView}]]; 408 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-left-[collectionView]-right-|" 409 | options:kNilOptions 410 | metrics:@{@"left": @(self.edgeInsets.left), 411 | @"right": @(self.edgeInsets.right)} 412 | views:@{@"collectionView": self.collectionView}]]; 413 | } 414 | 415 | - (void)stopTimer 416 | { 417 | if (self.autoScrollTimer && self.autoScrollTimer.isValid) { 418 | [self.autoScrollTimer invalidate]; 419 | self.autoScrollTimer = nil; 420 | } 421 | } 422 | @end 423 | 424 | 425 | -------------------------------------------------------------------------------- /ImagePlayerViewTests/ImagePlayerViewTests-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 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /ImagePlayerViewTests/ImagePlayerViewTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ImagePlayerViewTests.m 3 | // ImagePlayerViewTests 4 | // 5 | // Created by 陈颜俊 on 14-6-5. 6 | // Copyright (c) 2014年 Chenyanjun. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ImagePlayerViewTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ImagePlayerViewTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /ImagePlayerViewTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Images/ImagePlayerView-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/interchen/ImagePlayerView/3e4b7c88c98438b29f12bec679a2c7697751dc38/Images/ImagePlayerView-01.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) [2014] [Chenyanjun] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ImagePlayerView [![Build Status](https://travis-ci.org/interchen/ImagePlayerView.svg?branch=master)](https://travis-ci.org/interchen/ImagePlayerView) 2 | =============== 3 | 4 | * show a group of images in view 5 | * base on AutoLayout 6 | * custom UIPageControl position 7 | * support infinity scroll 8 | 9 | ## Show 10 | ![image](https://github.com/interchen/ImagePlayerView/blob/master/endless.gif) 11 | 12 | ## Installation with CocoaPods 13 | ```objective-c 14 | pod 'ImagePlayerView' 15 | ``` 16 | 17 | ## Usage 18 | ### init 19 | ```objective-c 20 | self.imageURLs = @[[NSURL URLWithString:@"http://sudasuta.com/wp-content/uploads/2013/10/10143181686_375e063f2c_z.jpg"], 21 | [NSURL URLWithString:@"http://www.yancheng.gov.cn/ztzl/zgycddhsdgy/xwdt/201109/W020110902584601289616.jpg"], 22 | [NSURL URLWithString:@"http://fzone.oushinet.com/bbs/data/attachment/forum/201208/15/074140zsb6ko6hfhzrb40q.jpg"]]; 23 | ``` 24 | 25 | ### implement delegate to load image 26 | ```objective-c 27 | #pragma mark - ImagePlayerViewDelegate 28 | - (NSInteger)numberOfItems 29 | { 30 | return self.imageURLs.count; 31 | } 32 | 33 | - (void)imagePlayerView:(ImagePlayerView *)imagePlayerView loadImageForImageView:(UIImageView *)imageView index:(NSInteger)index 34 | { 35 | // recommend to use SDWebImage lib to load web image 36 | // [imageView setImageWithURL:[self.imageURLs objectAtIndex:index] placeholderImage:nil]; 37 | 38 | imageView.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[self.imageURLs objectAtIndex:index]]]; 39 | } 40 | ``` 41 | ### important 42 | > clear imagePlayerView instance 43 | 44 | ```objective-c 45 | - (void)dealloc 46 | { 47 | // clear 48 | [self.imagePlayerView stopTimer]; 49 | self.imagePlayerView.imagePlayerViewDelegate = nil; 50 | self.imagePlayerView = nil; 51 | } 52 | ``` 53 | 54 | ### adjust pageControl position 55 | ```objective-c 56 | self.imagePlayerView.pageControlPosition = ICPageControlPosition_BottomLeft; 57 | ``` 58 | 59 | ### hide pageControl or not 60 | ```objective-c 61 | self.imagePlayerView.hidePageControl = NO; 62 | ``` 63 | 64 | ### adjust edgeInset 65 | ```objective-c 66 | self.imagePlayerView.edgeInsets = UIEdgeInsetsMake(10, 20, 30, 40); 67 | ``` 68 | 69 | ### endless switch 70 | ```objective-c 71 | self.imagePlayerView.endlessScroll = YES; 72 | ``` 73 | 74 | ## Versions 75 | ### v0.3.1 76 | [v0.3.1](https://github.com/interchen/ImagePlayerView/tree/0.3.1) dependenced on [SDWebImage](https://github.com/rs/SDWebImage) lib, you don't need to implement delegate to load image 77 | ```objective-c 78 | pod 'ImagePlayerView', '~> 0.3.1' 79 | ``` 80 | 81 | ### from v0.4 on 82 | remove dependence on [SDWebImage](https://github.com/rs/SDWebImage) lib, you should implement delegate to load image 83 | ```objective-c 84 | pod 'ImagePlayerView' 85 | ``` 86 | 87 | 88 | -------------------------------------------------------------------------------- /endless.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/interchen/ImagePlayerView/3e4b7c88c98438b29f12bec679a2c7697751dc38/endless.gif --------------------------------------------------------------------------------