├── ForFlipCountDownDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── DamonNG.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── ForFlipCountDownDemo.xcscheme │ └── xcschememanagement.plist ├── ForFlipCountDownDemo ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ ├── 0.imageset │ │ ├── 0.png │ │ ├── 0@2x.png │ │ └── Contents.json │ ├── 1.imageset │ │ ├── 1.png │ │ ├── 1@2x.png │ │ └── Contents.json │ ├── 2.imageset │ │ ├── 2.png │ │ ├── 2@2x.png │ │ └── Contents.json │ ├── 3.imageset │ │ ├── 3.png │ │ ├── 3@2x.png │ │ └── Contents.json │ ├── 4.imageset │ │ ├── 4.png │ │ ├── 4@2x.png │ │ └── Contents.json │ ├── 5.imageset │ │ ├── 5.png │ │ ├── 5@2x.png │ │ └── Contents.json │ ├── 6.imageset │ │ ├── 6.png │ │ ├── 6@2x.png │ │ └── Contents.json │ ├── 7.imageset │ │ ├── 7.png │ │ ├── 7@2x.png │ │ └── Contents.json │ ├── 8.imageset │ │ ├── 8.png │ │ ├── 8@2x.png │ │ └── Contents.json │ ├── 9.imageset │ │ ├── 9.png │ │ ├── 9@2x.png │ │ └── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── ViewController.h ├── ViewController.m ├── jhFlipCountDown │ ├── CustomLayer.h │ ├── CustomLayer.m │ ├── Flip.h │ ├── JHFlipCountDownView.h │ ├── JHFlipCountDownView.m │ ├── JHFlipNumberView.h │ └── JHFlipNumberView.m └── main.m ├── ForFlipCountDownDemoTests ├── ForFlipCountDownDemoTests.m └── Info.plist └── README.md /ForFlipCountDownDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 7F2676E81B4665FF00DFD23F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F2676E71B4665FF00DFD23F /* main.m */; }; 11 | 7F2676EB1B4665FF00DFD23F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F2676EA1B4665FF00DFD23F /* AppDelegate.m */; }; 12 | 7F2676EE1B4665FF00DFD23F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F2676ED1B4665FF00DFD23F /* ViewController.m */; }; 13 | 7F2676F11B4665FF00DFD23F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7F2676EF1B4665FF00DFD23F /* Main.storyboard */; }; 14 | 7F2676F31B4665FF00DFD23F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7F2676F21B4665FF00DFD23F /* Images.xcassets */; }; 15 | 7F2676F61B4665FF00DFD23F /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7F2676F41B4665FF00DFD23F /* LaunchScreen.xib */; }; 16 | 7F2677021B4665FF00DFD23F /* ForFlipCountDownDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F2677011B4665FF00DFD23F /* ForFlipCountDownDemoTests.m */; }; 17 | 7F2677101B4666C300DFD23F /* JHFlipCountDownView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F26770D1B4666C300DFD23F /* JHFlipCountDownView.m */; }; 18 | 7F2677111B4666C300DFD23F /* JHFlipNumberView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F26770F1B4666C300DFD23F /* JHFlipNumberView.m */; }; 19 | 7F2677191B466C8F00DFD23F /* CustomLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F2677171B466C8F00DFD23F /* CustomLayer.m */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 7F2676FC1B4665FF00DFD23F /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 7F2676DA1B4665FF00DFD23F /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 7F2676E11B4665FF00DFD23F; 28 | remoteInfo = ForFlipCountDownDemo; 29 | }; 30 | /* End PBXContainerItemProxy section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 7F2676E21B4665FF00DFD23F /* ForFlipCountDownDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ForFlipCountDownDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | 7F2676E61B4665FF00DFD23F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | 7F2676E71B4665FF00DFD23F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 36 | 7F2676E91B4665FF00DFD23F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 37 | 7F2676EA1B4665FF00DFD23F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 38 | 7F2676EC1B4665FF00DFD23F /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 39 | 7F2676ED1B4665FF00DFD23F /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 40 | 7F2676F01B4665FF00DFD23F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 41 | 7F2676F21B4665FF00DFD23F /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 42 | 7F2676F51B4665FF00DFD23F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 43 | 7F2676FB1B4665FF00DFD23F /* ForFlipCountDownDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ForFlipCountDownDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 7F2677001B4665FF00DFD23F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | 7F2677011B4665FF00DFD23F /* ForFlipCountDownDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ForFlipCountDownDemoTests.m; sourceTree = ""; }; 46 | 7F26770C1B4666C300DFD23F /* JHFlipCountDownView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JHFlipCountDownView.h; sourceTree = ""; }; 47 | 7F26770D1B4666C300DFD23F /* JHFlipCountDownView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JHFlipCountDownView.m; sourceTree = ""; }; 48 | 7F26770E1B4666C300DFD23F /* JHFlipNumberView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JHFlipNumberView.h; sourceTree = ""; }; 49 | 7F26770F1B4666C300DFD23F /* JHFlipNumberView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JHFlipNumberView.m; sourceTree = ""; }; 50 | 7F2677171B466C8F00DFD23F /* CustomLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomLayer.m; sourceTree = ""; }; 51 | 7F2677181B466C8F00DFD23F /* CustomLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomLayer.h; sourceTree = ""; }; 52 | 7F26771A1B466D0600DFD23F /* Flip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Flip.h; sourceTree = ""; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | 7F2676DF1B4665FF00DFD23F /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | 7F2676F81B4665FF00DFD23F /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | /* End PBXFrameworksBuildPhase section */ 71 | 72 | /* Begin PBXGroup section */ 73 | 7F2676D91B4665FF00DFD23F = { 74 | isa = PBXGroup; 75 | children = ( 76 | 7F2676E41B4665FF00DFD23F /* ForFlipCountDownDemo */, 77 | 7F2676FE1B4665FF00DFD23F /* ForFlipCountDownDemoTests */, 78 | 7F2676E31B4665FF00DFD23F /* Products */, 79 | ); 80 | sourceTree = ""; 81 | }; 82 | 7F2676E31B4665FF00DFD23F /* Products */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 7F2676E21B4665FF00DFD23F /* ForFlipCountDownDemo.app */, 86 | 7F2676FB1B4665FF00DFD23F /* ForFlipCountDownDemoTests.xctest */, 87 | ); 88 | name = Products; 89 | sourceTree = ""; 90 | }; 91 | 7F2676E41B4665FF00DFD23F /* ForFlipCountDownDemo */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 7F26770B1B4666C300DFD23F /* jhFlipCountDown */, 95 | 7F2676E91B4665FF00DFD23F /* AppDelegate.h */, 96 | 7F2676EA1B4665FF00DFD23F /* AppDelegate.m */, 97 | 7F2676EC1B4665FF00DFD23F /* ViewController.h */, 98 | 7F2676ED1B4665FF00DFD23F /* ViewController.m */, 99 | 7F2676EF1B4665FF00DFD23F /* Main.storyboard */, 100 | 7F2676F21B4665FF00DFD23F /* Images.xcassets */, 101 | 7F2676F41B4665FF00DFD23F /* LaunchScreen.xib */, 102 | 7F2676E51B4665FF00DFD23F /* Supporting Files */, 103 | ); 104 | path = ForFlipCountDownDemo; 105 | sourceTree = ""; 106 | }; 107 | 7F2676E51B4665FF00DFD23F /* Supporting Files */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 7F2676E61B4665FF00DFD23F /* Info.plist */, 111 | 7F2676E71B4665FF00DFD23F /* main.m */, 112 | ); 113 | name = "Supporting Files"; 114 | sourceTree = ""; 115 | }; 116 | 7F2676FE1B4665FF00DFD23F /* ForFlipCountDownDemoTests */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 7F2677011B4665FF00DFD23F /* ForFlipCountDownDemoTests.m */, 120 | 7F2676FF1B4665FF00DFD23F /* Supporting Files */, 121 | ); 122 | path = ForFlipCountDownDemoTests; 123 | sourceTree = ""; 124 | }; 125 | 7F2676FF1B4665FF00DFD23F /* Supporting Files */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 7F2677001B4665FF00DFD23F /* Info.plist */, 129 | ); 130 | name = "Supporting Files"; 131 | sourceTree = ""; 132 | }; 133 | 7F26770B1B4666C300DFD23F /* jhFlipCountDown */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 7F26771A1B466D0600DFD23F /* Flip.h */, 137 | 7F2677171B466C8F00DFD23F /* CustomLayer.m */, 138 | 7F2677181B466C8F00DFD23F /* CustomLayer.h */, 139 | 7F26770C1B4666C300DFD23F /* JHFlipCountDownView.h */, 140 | 7F26770D1B4666C300DFD23F /* JHFlipCountDownView.m */, 141 | 7F26770E1B4666C300DFD23F /* JHFlipNumberView.h */, 142 | 7F26770F1B4666C300DFD23F /* JHFlipNumberView.m */, 143 | ); 144 | path = jhFlipCountDown; 145 | sourceTree = ""; 146 | }; 147 | /* End PBXGroup section */ 148 | 149 | /* Begin PBXNativeTarget section */ 150 | 7F2676E11B4665FF00DFD23F /* ForFlipCountDownDemo */ = { 151 | isa = PBXNativeTarget; 152 | buildConfigurationList = 7F2677051B4665FF00DFD23F /* Build configuration list for PBXNativeTarget "ForFlipCountDownDemo" */; 153 | buildPhases = ( 154 | 7F2676DE1B4665FF00DFD23F /* Sources */, 155 | 7F2676DF1B4665FF00DFD23F /* Frameworks */, 156 | 7F2676E01B4665FF00DFD23F /* Resources */, 157 | ); 158 | buildRules = ( 159 | ); 160 | dependencies = ( 161 | ); 162 | name = ForFlipCountDownDemo; 163 | productName = ForFlipCountDownDemo; 164 | productReference = 7F2676E21B4665FF00DFD23F /* ForFlipCountDownDemo.app */; 165 | productType = "com.apple.product-type.application"; 166 | }; 167 | 7F2676FA1B4665FF00DFD23F /* ForFlipCountDownDemoTests */ = { 168 | isa = PBXNativeTarget; 169 | buildConfigurationList = 7F2677081B4665FF00DFD23F /* Build configuration list for PBXNativeTarget "ForFlipCountDownDemoTests" */; 170 | buildPhases = ( 171 | 7F2676F71B4665FF00DFD23F /* Sources */, 172 | 7F2676F81B4665FF00DFD23F /* Frameworks */, 173 | 7F2676F91B4665FF00DFD23F /* Resources */, 174 | ); 175 | buildRules = ( 176 | ); 177 | dependencies = ( 178 | 7F2676FD1B4665FF00DFD23F /* PBXTargetDependency */, 179 | ); 180 | name = ForFlipCountDownDemoTests; 181 | productName = ForFlipCountDownDemoTests; 182 | productReference = 7F2676FB1B4665FF00DFD23F /* ForFlipCountDownDemoTests.xctest */; 183 | productType = "com.apple.product-type.bundle.unit-test"; 184 | }; 185 | /* End PBXNativeTarget section */ 186 | 187 | /* Begin PBXProject section */ 188 | 7F2676DA1B4665FF00DFD23F /* Project object */ = { 189 | isa = PBXProject; 190 | attributes = { 191 | LastUpgradeCheck = 0630; 192 | ORGANIZATIONNAME = JiehaoWu; 193 | TargetAttributes = { 194 | 7F2676E11B4665FF00DFD23F = { 195 | CreatedOnToolsVersion = 6.3.2; 196 | }; 197 | 7F2676FA1B4665FF00DFD23F = { 198 | CreatedOnToolsVersion = 6.3.2; 199 | TestTargetID = 7F2676E11B4665FF00DFD23F; 200 | }; 201 | }; 202 | }; 203 | buildConfigurationList = 7F2676DD1B4665FF00DFD23F /* Build configuration list for PBXProject "ForFlipCountDownDemo" */; 204 | compatibilityVersion = "Xcode 3.2"; 205 | developmentRegion = English; 206 | hasScannedForEncodings = 0; 207 | knownRegions = ( 208 | en, 209 | Base, 210 | ); 211 | mainGroup = 7F2676D91B4665FF00DFD23F; 212 | productRefGroup = 7F2676E31B4665FF00DFD23F /* Products */; 213 | projectDirPath = ""; 214 | projectRoot = ""; 215 | targets = ( 216 | 7F2676E11B4665FF00DFD23F /* ForFlipCountDownDemo */, 217 | 7F2676FA1B4665FF00DFD23F /* ForFlipCountDownDemoTests */, 218 | ); 219 | }; 220 | /* End PBXProject section */ 221 | 222 | /* Begin PBXResourcesBuildPhase section */ 223 | 7F2676E01B4665FF00DFD23F /* Resources */ = { 224 | isa = PBXResourcesBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | 7F2676F11B4665FF00DFD23F /* Main.storyboard in Resources */, 228 | 7F2676F61B4665FF00DFD23F /* LaunchScreen.xib in Resources */, 229 | 7F2676F31B4665FF00DFD23F /* Images.xcassets in Resources */, 230 | ); 231 | runOnlyForDeploymentPostprocessing = 0; 232 | }; 233 | 7F2676F91B4665FF00DFD23F /* Resources */ = { 234 | isa = PBXResourcesBuildPhase; 235 | buildActionMask = 2147483647; 236 | files = ( 237 | ); 238 | runOnlyForDeploymentPostprocessing = 0; 239 | }; 240 | /* End PBXResourcesBuildPhase section */ 241 | 242 | /* Begin PBXSourcesBuildPhase section */ 243 | 7F2676DE1B4665FF00DFD23F /* Sources */ = { 244 | isa = PBXSourcesBuildPhase; 245 | buildActionMask = 2147483647; 246 | files = ( 247 | 7F2676EE1B4665FF00DFD23F /* ViewController.m in Sources */, 248 | 7F2677101B4666C300DFD23F /* JHFlipCountDownView.m in Sources */, 249 | 7F2677191B466C8F00DFD23F /* CustomLayer.m in Sources */, 250 | 7F2676EB1B4665FF00DFD23F /* AppDelegate.m in Sources */, 251 | 7F2677111B4666C300DFD23F /* JHFlipNumberView.m in Sources */, 252 | 7F2676E81B4665FF00DFD23F /* main.m in Sources */, 253 | ); 254 | runOnlyForDeploymentPostprocessing = 0; 255 | }; 256 | 7F2676F71B4665FF00DFD23F /* Sources */ = { 257 | isa = PBXSourcesBuildPhase; 258 | buildActionMask = 2147483647; 259 | files = ( 260 | 7F2677021B4665FF00DFD23F /* ForFlipCountDownDemoTests.m in Sources */, 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | }; 264 | /* End PBXSourcesBuildPhase section */ 265 | 266 | /* Begin PBXTargetDependency section */ 267 | 7F2676FD1B4665FF00DFD23F /* PBXTargetDependency */ = { 268 | isa = PBXTargetDependency; 269 | target = 7F2676E11B4665FF00DFD23F /* ForFlipCountDownDemo */; 270 | targetProxy = 7F2676FC1B4665FF00DFD23F /* PBXContainerItemProxy */; 271 | }; 272 | /* End PBXTargetDependency section */ 273 | 274 | /* Begin PBXVariantGroup section */ 275 | 7F2676EF1B4665FF00DFD23F /* Main.storyboard */ = { 276 | isa = PBXVariantGroup; 277 | children = ( 278 | 7F2676F01B4665FF00DFD23F /* Base */, 279 | ); 280 | name = Main.storyboard; 281 | sourceTree = ""; 282 | }; 283 | 7F2676F41B4665FF00DFD23F /* LaunchScreen.xib */ = { 284 | isa = PBXVariantGroup; 285 | children = ( 286 | 7F2676F51B4665FF00DFD23F /* Base */, 287 | ); 288 | name = LaunchScreen.xib; 289 | sourceTree = ""; 290 | }; 291 | /* End PBXVariantGroup section */ 292 | 293 | /* Begin XCBuildConfiguration section */ 294 | 7F2677031B4665FF00DFD23F /* Debug */ = { 295 | isa = XCBuildConfiguration; 296 | buildSettings = { 297 | ALWAYS_SEARCH_USER_PATHS = NO; 298 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 299 | CLANG_CXX_LIBRARY = "libc++"; 300 | CLANG_ENABLE_MODULES = YES; 301 | CLANG_ENABLE_OBJC_ARC = YES; 302 | CLANG_WARN_BOOL_CONVERSION = YES; 303 | CLANG_WARN_CONSTANT_CONVERSION = YES; 304 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 305 | CLANG_WARN_EMPTY_BODY = YES; 306 | CLANG_WARN_ENUM_CONVERSION = YES; 307 | CLANG_WARN_INT_CONVERSION = YES; 308 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 309 | CLANG_WARN_UNREACHABLE_CODE = YES; 310 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 311 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 312 | COPY_PHASE_STRIP = NO; 313 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 314 | ENABLE_STRICT_OBJC_MSGSEND = YES; 315 | GCC_C_LANGUAGE_STANDARD = gnu99; 316 | GCC_DYNAMIC_NO_PIC = NO; 317 | GCC_NO_COMMON_BLOCKS = YES; 318 | GCC_OPTIMIZATION_LEVEL = 0; 319 | GCC_PREPROCESSOR_DEFINITIONS = ( 320 | "DEBUG=1", 321 | "$(inherited)", 322 | ); 323 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 324 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 325 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 326 | GCC_WARN_UNDECLARED_SELECTOR = YES; 327 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 328 | GCC_WARN_UNUSED_FUNCTION = YES; 329 | GCC_WARN_UNUSED_VARIABLE = YES; 330 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 331 | MTL_ENABLE_DEBUG_INFO = YES; 332 | ONLY_ACTIVE_ARCH = YES; 333 | SDKROOT = iphoneos; 334 | }; 335 | name = Debug; 336 | }; 337 | 7F2677041B4665FF00DFD23F /* Release */ = { 338 | isa = XCBuildConfiguration; 339 | buildSettings = { 340 | ALWAYS_SEARCH_USER_PATHS = NO; 341 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 342 | CLANG_CXX_LIBRARY = "libc++"; 343 | CLANG_ENABLE_MODULES = YES; 344 | CLANG_ENABLE_OBJC_ARC = YES; 345 | CLANG_WARN_BOOL_CONVERSION = YES; 346 | CLANG_WARN_CONSTANT_CONVERSION = YES; 347 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 348 | CLANG_WARN_EMPTY_BODY = YES; 349 | CLANG_WARN_ENUM_CONVERSION = YES; 350 | CLANG_WARN_INT_CONVERSION = YES; 351 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 352 | CLANG_WARN_UNREACHABLE_CODE = YES; 353 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 354 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 355 | COPY_PHASE_STRIP = NO; 356 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 357 | ENABLE_NS_ASSERTIONS = NO; 358 | ENABLE_STRICT_OBJC_MSGSEND = YES; 359 | GCC_C_LANGUAGE_STANDARD = gnu99; 360 | GCC_NO_COMMON_BLOCKS = YES; 361 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 362 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 363 | GCC_WARN_UNDECLARED_SELECTOR = YES; 364 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 365 | GCC_WARN_UNUSED_FUNCTION = YES; 366 | GCC_WARN_UNUSED_VARIABLE = YES; 367 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 368 | MTL_ENABLE_DEBUG_INFO = NO; 369 | SDKROOT = iphoneos; 370 | VALIDATE_PRODUCT = YES; 371 | }; 372 | name = Release; 373 | }; 374 | 7F2677061B4665FF00DFD23F /* Debug */ = { 375 | isa = XCBuildConfiguration; 376 | buildSettings = { 377 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 378 | INFOPLIST_FILE = ForFlipCountDownDemo/Info.plist; 379 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 380 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 381 | PRODUCT_NAME = "$(TARGET_NAME)"; 382 | }; 383 | name = Debug; 384 | }; 385 | 7F2677071B4665FF00DFD23F /* Release */ = { 386 | isa = XCBuildConfiguration; 387 | buildSettings = { 388 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 389 | INFOPLIST_FILE = ForFlipCountDownDemo/Info.plist; 390 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 391 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 392 | PRODUCT_NAME = "$(TARGET_NAME)"; 393 | }; 394 | name = Release; 395 | }; 396 | 7F2677091B4665FF00DFD23F /* Debug */ = { 397 | isa = XCBuildConfiguration; 398 | buildSettings = { 399 | BUNDLE_LOADER = "$(TEST_HOST)"; 400 | FRAMEWORK_SEARCH_PATHS = ( 401 | "$(SDKROOT)/Developer/Library/Frameworks", 402 | "$(inherited)", 403 | ); 404 | GCC_PREPROCESSOR_DEFINITIONS = ( 405 | "DEBUG=1", 406 | "$(inherited)", 407 | ); 408 | INFOPLIST_FILE = ForFlipCountDownDemoTests/Info.plist; 409 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 410 | PRODUCT_NAME = "$(TARGET_NAME)"; 411 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ForFlipCountDownDemo.app/ForFlipCountDownDemo"; 412 | }; 413 | name = Debug; 414 | }; 415 | 7F26770A1B4665FF00DFD23F /* Release */ = { 416 | isa = XCBuildConfiguration; 417 | buildSettings = { 418 | BUNDLE_LOADER = "$(TEST_HOST)"; 419 | FRAMEWORK_SEARCH_PATHS = ( 420 | "$(SDKROOT)/Developer/Library/Frameworks", 421 | "$(inherited)", 422 | ); 423 | INFOPLIST_FILE = ForFlipCountDownDemoTests/Info.plist; 424 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 425 | PRODUCT_NAME = "$(TARGET_NAME)"; 426 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ForFlipCountDownDemo.app/ForFlipCountDownDemo"; 427 | }; 428 | name = Release; 429 | }; 430 | /* End XCBuildConfiguration section */ 431 | 432 | /* Begin XCConfigurationList section */ 433 | 7F2676DD1B4665FF00DFD23F /* Build configuration list for PBXProject "ForFlipCountDownDemo" */ = { 434 | isa = XCConfigurationList; 435 | buildConfigurations = ( 436 | 7F2677031B4665FF00DFD23F /* Debug */, 437 | 7F2677041B4665FF00DFD23F /* Release */, 438 | ); 439 | defaultConfigurationIsVisible = 0; 440 | defaultConfigurationName = Release; 441 | }; 442 | 7F2677051B4665FF00DFD23F /* Build configuration list for PBXNativeTarget "ForFlipCountDownDemo" */ = { 443 | isa = XCConfigurationList; 444 | buildConfigurations = ( 445 | 7F2677061B4665FF00DFD23F /* Debug */, 446 | 7F2677071B4665FF00DFD23F /* Release */, 447 | ); 448 | defaultConfigurationIsVisible = 0; 449 | defaultConfigurationName = Release; 450 | }; 451 | 7F2677081B4665FF00DFD23F /* Build configuration list for PBXNativeTarget "ForFlipCountDownDemoTests" */ = { 452 | isa = XCConfigurationList; 453 | buildConfigurations = ( 454 | 7F2677091B4665FF00DFD23F /* Debug */, 455 | 7F26770A1B4665FF00DFD23F /* Release */, 456 | ); 457 | defaultConfigurationIsVisible = 0; 458 | defaultConfigurationName = Release; 459 | }; 460 | /* End XCConfigurationList section */ 461 | }; 462 | rootObject = 7F2676DA1B4665FF00DFD23F /* Project object */; 463 | } 464 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo.xcodeproj/xcuserdata/DamonNG.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo.xcodeproj/xcuserdata/DamonNG.xcuserdatad/xcschemes/ForFlipCountDownDemo.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 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo.xcodeproj/xcuserdata/DamonNG.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ForFlipCountDownDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 7F2676E11B4665FF00DFD23F 16 | 17 | primary 18 | 19 | 20 | 7F2676FA1B4665FF00DFD23F 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ForFlipCountDownDemo 4 | // 5 | // Created by DamonNG on 15/7/3. 6 | // Copyright (c) 2015年 JiehaoWu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ForFlipCountDownDemo 4 | // 5 | // Created by DamonNG on 15/7/3. 6 | // Copyright (c) 2015年 JiehaoWu. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo/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 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo/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 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/0.imageset/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/0.imageset/0.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/0.imageset/0@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/0.imageset/0@2x.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/0.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "0.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "0@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/1.imageset/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/1.imageset/1.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/1.imageset/1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/1.imageset/1@2x.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "1.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "1@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/2.imageset/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/2.imageset/2.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/2.imageset/2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/2.imageset/2@2x.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "2.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "2@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/3.imageset/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/3.imageset/3.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/3.imageset/3@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/3.imageset/3@2x.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "3.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "3@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/4.imageset/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/4.imageset/4.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/4.imageset/4@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/4.imageset/4@2x.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "4.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "4@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/5.imageset/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/5.imageset/5.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/5.imageset/5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/5.imageset/5@2x.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "5.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "5@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/6.imageset/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/6.imageset/6.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/6.imageset/6@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/6.imageset/6@2x.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/6.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "6.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "6@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/7.imageset/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/7.imageset/7.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/7.imageset/7@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/7.imageset/7@2x.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/7.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "7.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "7@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/8.imageset/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/8.imageset/8.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/8.imageset/8@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/8.imageset/8@2x.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/8.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "8.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "8@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/9.imageset/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/9.imageset/9.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/9.imageset/9@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SummerWu/ForFlipCountDownDemo/faa28b35bbbd7f7b5c917b842731f0c289d15ded/ForFlipCountDownDemo/Images.xcassets/9.imageset/9@2x.png -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Images.xcassets/9.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "9.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "9@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ForFlipCountDownDemo/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 | } -------------------------------------------------------------------------------- /ForFlipCountDownDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | sohu.$(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 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // ForFlipCountDownDemo 4 | // 5 | // Created by DamonNG on 15/7/3. 6 | // Copyright (c) 2015年 JiehaoWu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // ForFlipCountDownDemo 4 | // 5 | // Created by DamonNG on 15/7/3. 6 | // Copyright (c) 2015年 JiehaoWu. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "JHFlipCountDownView.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | 21 | //使用JHFlipCountDownView 22 | JHFlipCountDownView *flipCountDownView = [[JHFlipCountDownView alloc] initWithFrame:CGRectMake((self.view.frame.size.width-150)/2, 100, 150, 35) countDownType:TYPE_HHmmss countDownTime:[self p_haveTime]]; 23 | [self.view addSubview:flipCountDownView]; 24 | 25 | [flipCountDownView startCountDown]; 26 | } 27 | 28 | 29 | - (void)didReceiveMemoryWarning { 30 | [super didReceiveMemoryWarning]; 31 | // Dispose of any resources that can be recreated. 32 | } 33 | 34 | 35 | #pragma mark Private Methods 36 | -(NSDate*)p_haveTime { 37 | NSDate *nowDate = [NSDate date]; 38 | NSDate *tomorrowDate = [nowDate dateByAddingTimeInterval:24*60*60]; 39 | NSDateFormatter * df = [[NSDateFormatter alloc] init]; 40 | df.dateFormat = @"yyyy-MM-dd"; 41 | NSString * stringDate = [df stringFromDate:tomorrowDate]; 42 | 43 | tomorrowDate = [df dateFromString:stringDate]; 44 | 45 | NSDate *haveDate = [NSDate dateWithTimeIntervalSinceReferenceDate:(tomorrowDate.timeIntervalSince1970-nowDate.timeIntervalSince1970)]; 46 | 47 | return haveDate; 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo/jhFlipCountDown/CustomLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // CustomLayer.h 3 | // ForFlipBoard 4 | // 5 | // Created by DamonNG on 15/6/19. 6 | // Copyright (c) 2015年 DamonNG. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | /** 13 | * 自定义layer 14 | */ 15 | @interface CustomLayer : CATransformLayer 16 | 17 | @property (nonatomic) CGFloat rotateDegree; 18 | 19 | /** 20 | * 双层layer 21 | */ 22 | @property (nonatomic,retain) CALayer *frontLayer; 23 | @property (nonatomic,retain) CALayer *backLayer; 24 | 25 | -(id)initWithFrame:(CGRect)frame; 26 | /** 27 | * 正面的内容 28 | * 29 | * @param images 正面的图像 30 | */ 31 | -(void)setFrontLayerContent:(UIImage*)images; 32 | /** 33 | * 背面的内容 34 | * 35 | * @param images 背面的图像 36 | */ 37 | -(void)setBackLayerContent:(UIImage*)images; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo/jhFlipCountDown/CustomLayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // CustomLayer.m 3 | // ForFlipBoard 4 | // 5 | // Created by DamonNG on 15/6/19. 6 | // Copyright (c) 2015年 DamonNG. All rights reserved. 7 | // 8 | 9 | #import "CustomLayer.h" 10 | #import "Flip.h" 11 | 12 | @implementation CustomLayer 13 | 14 | +(NSArray*)sharedBackgroundImagesWithRect:(CGRect)rect{ 15 | static NSArray *images=nil; 16 | static dispatch_once_t onceToken; 17 | dispatch_once(&onceToken, ^{ 18 | UIImage *backgroundImage=JHFlip_line_radial_image(rect); 19 | images=JHFlip_make_hsplit_images_for_image(backgroundImage); 20 | NSLog(@"shared background image"); 21 | }); 22 | return images; 23 | } 24 | 25 | #pragma mark Public Methods 26 | -(id)initWithFrame:(CGRect)frame{ 27 | self=[super init]; 28 | if (self){ 29 | self.frame=frame; 30 | self.doubleSided=YES; 31 | self.anchorPoint=CGPointMake(0.5, 1.0f); 32 | self.position=CGPointMake(self.position.x, 33 | self.position.y-self.frame.size.height/2); 34 | 35 | // CGRect rect=CGRectMake(0.0f, 0.0f, frame.size.width, frame.size.height*2); 36 | // UIImage *image_1=[CustomLayer sharedBackgroundImagesWithRect:rect][0]; 37 | // UIImage *image_2=[CustomLayer sharedBackgroundImagesWithRect:rect][1]; 38 | 39 | _frontLayer=[[CALayer alloc]init]; 40 | _frontLayer.frame=self.bounds; 41 | _frontLayer.backgroundColor=[UIColor whiteColor].CGColor; 42 | _frontLayer.doubleSided=NO; 43 | _frontLayer.name=@"frontLayer"; 44 | _frontLayer.opaque=NO; 45 | //_frontLayer.contents=(id)image_2.CGImage; 46 | 47 | _backLayer=[[CALayer alloc]init]; 48 | _backLayer.frame=self.bounds; 49 | _backLayer.backgroundColor=[UIColor whiteColor].CGColor; 50 | _backLayer.doubleSided=YES; 51 | _backLayer.name=@"backLayer"; 52 | //_backLayer.contents=(id)image_1.CGImage; 53 | _backLayer.transform=JHFlipCATransform3DPerspectSimpleWithRotate(180.0f); 54 | _backLayer.opaque=YES; 55 | 56 | [self addSublayer:_backLayer]; 57 | [self addSublayer:_frontLayer]; 58 | } 59 | return self; 60 | } 61 | 62 | -(void)setFrontLayerContent:(UIImage *)images 63 | { 64 | _frontLayer.contents=(id)images.CGImage; 65 | } 66 | -(void)setBackLayerContent:(UIImage *)images 67 | { 68 | _backLayer.contents=(id)images.CGImage; 69 | } 70 | 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo/jhFlipCountDown/Flip.h: -------------------------------------------------------------------------------- 1 | // 2 | // Flip.h 3 | // ForFlipBoard 4 | // 5 | // Created by DamonNG on 15/6/19. 6 | // Copyright (c) 2015年 DamonNG. All rights reserved. 7 | // 8 | #import 9 | 10 | #ifndef ForFlipBoard_Flip_h 11 | #define ForFlipBoard_Flip_h 12 | 13 | ///获取主目录 14 | #define WKFLIPS_PATH_HOME NSHomeDirectory() 15 | ///获取临时目录 16 | #define WKFLIPS_PATH_TEMP NSTemporaryDirectory() 17 | ///获取文档目录 18 | #define WKFLIPS_PATH_DOCUMENT NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0] 19 | 20 | ///系统版本号 21 | #define WKFLIPS_CURRENTSYSTEMVERSIONFLOAT [[[UIDevice currentDevice] systemVersion] floatValue] 22 | ///当前系统是否是ios7 23 | #define WKFLIPS_IOS7 BUS_CURRENTSYSTEMVERSIONFLOAT==7.0f 24 | 25 | ///状态条的高度 26 | #define WKFLIPS_STATUSBAR_HEIGHT 20.0f 27 | 28 | #define WKFLIPS_IPOD [[UIDevice currentDevice].model rangeOfString:@"iPod"].location!=NSNotFound 29 | 30 | static inline CATransform3D JHFlipCATransform3DMakePerspective(CGPoint center, float disZ) 31 | { 32 | // CATransform3D transToCenter = CATransform3DMakeTranslation(-center.x, -center.y,0.0f); 33 | // CATransform3D transBack = CATransform3DMakeTranslation(center.x, center.y, 0.0f); 34 | // CATransform3D scale = CATransform3DIdentity; 35 | // scale.m34 = 1.0f/-disZ; 36 | // return CATransform3DConcat(CATransform3DConcat(transToCenter, scale), transBack); 37 | CATransform3D transform=CATransform3DIdentity; 38 | transform.m34=1.0f/-disZ; 39 | return transform; 40 | } 41 | static inline CATransform3D JHFlipCATransform3DPerspect(CATransform3D t, CGPoint center, float disZ) 42 | { 43 | return CATransform3DConcat(t, JHFlipCATransform3DMakePerspective(center, disZ)); 44 | } 45 | static inline CATransform3D JHFlipCATransform3DPerspectSimple(CATransform3D t){ 46 | return JHFlipCATransform3DPerspect(t, CGPointMake(0, 0), 3000.0f); 47 | } 48 | static inline CATransform3D JHFlipCATransform3DPerspectSimpleWithRotate(CGFloat degree){ 49 | return JHFlipCATransform3DPerspectSimple(CATransform3DMakeRotation((M_PI*degree/180.0f), 1.0, 0.0, 0.0)); 50 | } 51 | 52 | 53 | ///为UIView创建一个截图 54 | static inline UIImage* JHFlip_make_image_for_view(UIView* view){ 55 | // double startTime=CFAbsoluteTimeGetCurrent(); 56 | if(UIGraphicsBeginImageContextWithOptions != NULL){ 57 | UIGraphicsBeginImageContextWithOptions(view.frame.size, NO, 0.0); 58 | } else { 59 | UIGraphicsBeginImageContext(view.frame.size); 60 | } 61 | if (WKFLIPS_CURRENTSYSTEMVERSIONFLOAT>=7.0f){ 62 | [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES]; 63 | } 64 | else{ 65 | [view.layer renderInContext:UIGraphicsGetCurrentContext()];///在iOS7.0下使用这个会使得UITextView在editable=NO时只绘制部分内容 66 | } 67 | // 68 | UIImage* image=UIGraphicsGetImageFromCurrentImageContext(); 69 | UIGraphicsEndImageContext(); 70 | // NSLog(@"makeImage duration:%f", CFAbsoluteTimeGetCurrent()-startTime); 71 | return image; 72 | } 73 | ///分割图片 74 | static inline NSArray* JHFlip_make_hsplit_images_for_image(UIImage* image){ 75 | CGSize halfSize=CGSizeMake(image.size.width, image.size.height/2); 76 | UIGraphicsBeginImageContext(halfSize); 77 | CGContextRef context=UIGraphicsGetCurrentContext(); 78 | CGContextSaveGState(context); 79 | // Flip the coordinate system 80 | CGContextSetTextMatrix(context, CGAffineTransformIdentity); // 2-1 81 | CGContextTranslateCTM(context, 0, halfSize.height); // 3-1 82 | CGContextScaleCTM(context, 1.0, -1.0); // 4-1 83 | CGImageRef imageRef=image.CGImage; 84 | CGContextDrawImage(context, CGRectMake(0, -1*halfSize.height, 85 | image.size.width, 86 | image.size.height), 87 | imageRef); 88 | UIImage* imageFirst=UIGraphicsGetImageFromCurrentImageContext(); 89 | 90 | CGContextClearRect(context, CGRectMake(0, 0, image.size.width , image.size.height)); 91 | CGContextDrawImage(context, CGRectMake(0,0, 92 | image.size.width, 93 | image.size.height), 94 | imageRef); 95 | UIImage* imageSecond=UIGraphicsGetImageFromCurrentImageContext(); 96 | CGContextRestoreGState(context); 97 | UIGraphicsEndImageContext(); 98 | //WLog_Float(@"hSplitImageToArray duration", CFAbsoluteTimeGetCurrent()-startTime); 99 | return @[imageFirst,imageSecond,]; 100 | } 101 | ///为UIView创建截图并且分割 102 | static inline NSArray* JHFlip_make_hsplit_images_for_view(UIView* view){ 103 | UIImage* image=JHFlip_make_image_for_view(view); 104 | return JHFlip_make_hsplit_images_for_image(image); 105 | } 106 | /** 107 | * 线性背景图 108 | * 109 | * @param rect 110 | * 111 | * @return 112 | */ 113 | static inline UIImage *JHFlip_line_gradient_image(CGRect rect){ 114 | if(UIGraphicsBeginImageContextWithOptions != NULL){ 115 | UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0.0); 116 | } else { 117 | UIGraphicsBeginImageContext(rect.size); 118 | } 119 | CGContextRef context = UIGraphicsGetCurrentContext(); // 1-1 120 | CGContextSaveGState(context); 121 | CGGradientRef myGradient; 122 | CGColorSpaceRef myColorspace; 123 | size_t num_locations = 2; 124 | CGFloat locations[2] = { 0.0, 1.0 }; 125 | CGFloat components[8] = { 1.0,1.0,1.0, 1.0, // Start color 126 | 0.0,0.0,0.0,0.3}; // End color 127 | myColorspace = CGColorSpaceCreateDeviceRGB(); 128 | myGradient = CGGradientCreateWithColorComponents (myColorspace, components, 129 | locations, num_locations); 130 | CGContextDrawLinearGradient(context, myGradient, CGPointMake(rect.size.width/2, 0.0f), 131 | CGPointMake(rect.size.width/2, rect.size.height*2.0f), kCGGradientDrawsAfterEndLocation); 132 | 133 | CGContextRestoreGState(context); 134 | CGColorSpaceRelease(myColorspace); 135 | CGGradientRelease(myGradient); 136 | 137 | UIImage* image=UIGraphicsGetImageFromCurrentImageContext(); 138 | return image; 139 | } 140 | static inline UIImage *JHFlip_line_radial_image(CGRect rect){ 141 | // Drawing code 142 | if(UIGraphicsBeginImageContextWithOptions != NULL){ 143 | UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0.0); 144 | } else { 145 | UIGraphicsBeginImageContext(rect.size); 146 | } 147 | CGContextRef context = UIGraphicsGetCurrentContext(); // 1-1 148 | CGContextSaveGState(context); 149 | CGGradientRef myGradient; 150 | CGColorSpaceRef myColorspace; 151 | size_t num_locations = 2; 152 | CGFloat locations[2] = { 0.0, 1.0 }; 153 | CGFloat components[8] = { 1.0,1.0,1.0, 1.0, // Start color 154 | 0.8,0.8,0.8,1.0}; // End color 155 | myColorspace = CGColorSpaceCreateDeviceRGB(); 156 | myGradient = CGGradientCreateWithColorComponents (myColorspace, components, 157 | locations, num_locations); 158 | CGPoint myStartPoint={rect.size.width/2, 159 | rect.size.height/3}; 160 | CGFloat myStartRadius=0, myEndRadius=rect.size.height*1.0; 161 | CGContextDrawRadialGradient (context, myGradient, myStartPoint, 162 | myStartRadius, myStartPoint, myEndRadius, 163 | kCGGradientDrawsAfterEndLocation); 164 | 165 | CGContextRestoreGState(context); 166 | CGColorSpaceRelease(myColorspace); 167 | CGGradientRelease(myGradient); 168 | 169 | UIImage* image=UIGraphicsGetImageFromCurrentImageContext(); 170 | UIGraphicsEndImageContext(); 171 | return image; 172 | } 173 | 174 | #endif 175 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo/jhFlipCountDown/JHFlipCountDownView.h: -------------------------------------------------------------------------------- 1 | // 2 | // JHFlipCountDownView.h 3 | // ForFlipBoard 4 | // 5 | // Created by DamonNG on 15/7/3. 6 | // Copyright (c) 2015年 DamonNG. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //创建倒计时的类型 12 | typedef enum COUNT_DOWN_TYPE{ 13 | TYPE_HHmmss,//HH:mm:ss 14 | TYPE_s //s,单个数字 15 | }COUNT_DOWN_TYPE; 16 | 17 | @interface JHFlipCountDownView : UIView 18 | 19 | /** 20 | * 初始化一个倒计时表 21 | * 22 | * @param frame 倒计时frame 23 | * @param countDowntype 时间的格式 24 | * @param countDownTime 传入倒计的时间 25 | * 26 | * @return 返回一个倒计时表 27 | */ 28 | -(id)initWithFrame:(CGRect)frame countDownType:(COUNT_DOWN_TYPE)countDowntype countDownTime:(NSDate *)countDownTime; 29 | 30 | /** 31 | * 开始倒计时 32 | */ 33 | -(void)startCountDown; 34 | 35 | /** 36 | * 停止倒计时 37 | */ 38 | -(void)stopCountDown; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo/jhFlipCountDown/JHFlipCountDownView.m: -------------------------------------------------------------------------------- 1 | // 2 | // JHFlipCountDownView.m 3 | // ForFlipBoard 4 | // 5 | // Created by DamonNG on 15/7/3. 6 | // Copyright (c) 2015年 DamonNG. All rights reserved. 7 | // 8 | 9 | #import "JHFlipCountDownView.h" 10 | #import "JHFlipNumberView.h" 11 | 12 | //一个Flip之间的间距 13 | #define ONE_FLIP_MARGIN 2 14 | //两个Flip之间的间距 15 | #define TWO_FLIP_MARGIN 6 16 | //TYPE_HHmmss类型的Flip数量 17 | #define TYPE_HHmmss_NUMBER 6 18 | 19 | @implementation JHFlipCountDownView 20 | { 21 | COUNT_DOWN_TYPE _countDownType; 22 | NSDate *_countDownTime; 23 | NSMutableArray *_flipArray; 24 | 25 | NSTimer *_countDowmTimer; 26 | } 27 | 28 | -(void)dealloc { 29 | _countDownTime = nil; 30 | _flipArray = nil; 31 | _countDowmTimer = nil; 32 | } 33 | 34 | #pragma mark public Methods 35 | -(id)initWithFrame:(CGRect)frame countDownType:(COUNT_DOWN_TYPE)countDowntype countDownTime:(NSDate *)countDownTime { 36 | self = [super initWithFrame:frame]; 37 | if (self) { 38 | _countDownType = countDowntype; 39 | _countDownTime = countDownTime; 40 | [self p_initUI]; 41 | } 42 | return self; 43 | } 44 | -(void)startCountDown { 45 | [_countDowmTimer invalidate]; 46 | _countDowmTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(countDownAction) userInfo:nil repeats:YES]; 47 | } 48 | -(void)stopCountDown { 49 | [_countDowmTimer invalidate]; 50 | } 51 | 52 | #pragma mark Private Methods 53 | //拿到_countDownTime中第index个数字 54 | -(NSInteger)p_NumberWithIndex:(NSInteger)index { 55 | NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; 56 | [dateFormatter setDateFormat:@"HHmmss"]; 57 | [dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"GMT"]]; 58 | NSString *currentDateStr = [dateFormatter stringFromDate:_countDownTime]; 59 | return [[currentDateStr substringWithRange:NSMakeRange(index,1)] integerValue]; 60 | } 61 | 62 | -(void)p_initUI { 63 | if (_countDownType == TYPE_HHmmss) { 64 | _flipArray = [[NSMutableArray alloc]initWithCapacity:TYPE_HHmmss_NUMBER]; 65 | CGFloat flipWidth = (self.frame.size.width-TWO_FLIP_MARGIN*2-ONE_FLIP_MARGIN*3)/TYPE_HHmmss_NUMBER; 66 | CGFloat flipHeight = self.frame.size.height; 67 | CGFloat x=0,y=0; 68 | NSArray *flipNumberArray = @[@(3),@(10),@(6),@(10),@(6),@(10)]; 69 | for (int i=0; i=0; i--) { 98 | if ([[currentDateStr substringWithRange:NSMakeRange(i, 1)] integerValue] > 0) { 99 | for (int j = TYPE_HHmmss_NUMBER - 1; j >= i; j --) { 100 | JHFlipNumberView *flipNumberView = [_flipArray objectAtIndex:j]; 101 | [flipNumberView startOnce]; 102 | } 103 | break; 104 | } 105 | } 106 | double haveSeconds = _countDownTime.timeIntervalSince1970 - 1; 107 | _countDownTime = [NSDate dateWithTimeIntervalSince1970:haveSeconds]; 108 | } 109 | 110 | @end 111 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo/jhFlipCountDown/JHFlipNumberView.h: -------------------------------------------------------------------------------- 1 | // 2 | // JHFlipNumberView.h 3 | // ForFlipBoard 4 | // 5 | // Created by DamonNG on 15/7/2. 6 | // Copyright (c) 2015年 DamonNG. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JHFlipNumberView : UIView 12 | 13 | /** 14 | * 初始化一个NumberView 15 | * 16 | * @param frame NumberView frame 17 | * @param currentPage 当前的页面 18 | * @param flipNumber 总页面数目 19 | * 20 | * @return 返回一个NumberView 21 | */ 22 | -(id)initWithFrame:(CGRect)frame CurrentPage:(NSInteger)currentPage FlipNumber:(NSInteger)flipNumber; 23 | 24 | /** 25 | * 开始循环翻转 26 | */ 27 | -(void)startCycle; 28 | 29 | /** 30 | * 开始翻转 31 | */ 32 | -(void)startOnce; 33 | 34 | /** 35 | * 停止翻转 36 | */ 37 | -(void)stop; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo/jhFlipCountDown/JHFlipNumberView.m: -------------------------------------------------------------------------------- 1 | // 2 | // JHFlipNumberView.m 3 | // ForFlipBoard 4 | // 5 | // Created by DamonNG on 15/7/2. 6 | // Copyright (c) 2015年 DamonNG. All rights reserved. 7 | // 8 | 9 | #import "JHFlipNumberView.h" 10 | #import "CustomLayer.h" 11 | #import "Flip.h" 12 | 13 | #define kDegreesToRadian(x) (M_PI * (x) / 180.0 ) 14 | 15 | #define kRadianToDegrees(radian) (radian* 180.0 )/(M_PI) 16 | 17 | 18 | @interface JHFlipNumberView () 19 | { 20 | //存储所有数字的View 21 | NSMutableArray *viewArray; 22 | //存储所有的layer 23 | NSMutableArray *layerArray; 24 | //存储辅助的layer 25 | NSMutableArray *layerHelperArray; 26 | //存储底部的View 27 | NSMutableArray *bottomViewArray; 28 | //正在翻滚的页面 29 | CustomLayer* _dragging_layer; 30 | //下一个页面 31 | CustomLayer* _next_layer; 32 | //这个layer停留在bottom,造成视觉效果 33 | CustomLayer* _bottom_layer; 34 | //当前页数 35 | NSInteger _currentPage; 36 | //总页数 37 | NSInteger _flipNumber; 38 | //View下半部分的显示 39 | UIImageView *_bottomImageView; 40 | 41 | NSTimer *timer; 42 | } 43 | 44 | @end 45 | 46 | @implementation JHFlipNumberView 47 | 48 | -(void)dealloc{ 49 | [timer invalidate]; 50 | timer = nil; 51 | viewArray=nil; 52 | bottomViewArray=nil; 53 | layerArray=nil; 54 | layerHelperArray=nil; 55 | _dragging_layer = nil; 56 | _next_layer = nil; 57 | _bottom_layer = nil; 58 | _bottomImageView = nil; 59 | } 60 | 61 | -(id)initWithFrame:(CGRect)frame CurrentPage:(NSInteger)currentPage FlipNumber:(NSInteger)flipNumber{ 62 | self = [super initWithFrame:frame]; 63 | if (self) { 64 | _flipNumber = flipNumber; 65 | _currentPage = _flipNumber-currentPage-1; 66 | [self p_initUI]; 67 | [self p_allocData]; 68 | [self p_buildLayers]; 69 | [self p_initData]; 70 | } 71 | return self; 72 | } 73 | 74 | -(void)startCycle { 75 | [timer invalidate]; 76 | timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerFired) userInfo:nil repeats:YES]; 77 | } 78 | 79 | -(void)startOnce { 80 | [self timerFired]; 81 | } 82 | 83 | -(void)stop { 84 | [timer invalidate]; 85 | } 86 | 87 | -(void)p_initUI { 88 | _bottomImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, self.frame.size.height/2, self.frame.size.width, self.frame.size.height/2)]; 89 | [self addSubview:_bottomImageView]; 90 | } 91 | 92 | -(void)p_allocData { 93 | viewArray = [[NSMutableArray alloc]initWithCapacity:_flipNumber]; 94 | bottomViewArray = [[NSMutableArray alloc]initWithCapacity:_flipNumber]; 95 | layerArray = [NSMutableArray arrayWithCapacity:_flipNumber]; 96 | layerHelperArray = [[NSMutableArray alloc]initWithCapacity:_flipNumber]; 97 | } 98 | 99 | -(void)p_initData { 100 | _bottomImageView.image = bottomViewArray[_currentPage]; 101 | } 102 | 103 | -(void)p_buildLayers 104 | { 105 | for (int a=0; a<_flipNumber; a++) { 106 | UIView *helpView = [[UIView alloc]initWithFrame:self.frame]; 107 | UIImageView *imageView =[[UIImageView alloc]initWithFrame:helpView.bounds]; 108 | imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d.png",a]]; 109 | [helpView addSubview:imageView]; 110 | [viewArray addObject:helpView]; 111 | } 112 | 113 | CGRect layerFrame=CGRectMake(0.0f, self.bounds.size.height/2, self.bounds.size.width, self.bounds.size.height/2); 114 | 115 | for (int a=(int)_flipNumber-1; a>=0; a--) { 116 | CustomLayer* layer=[[CustomLayer alloc]initWithFrame:layerFrame]; 117 | [layer setFrontLayerContent:JHFlip_make_hsplit_images_for_view(viewArray[a])[0]]; 118 | [bottomViewArray addObject:JHFlip_make_hsplit_images_for_view(viewArray[a])[1]]; 119 | if (a == 0) { 120 | [layer setBackLayerContent:JHFlip_make_hsplit_images_for_view(viewArray[_flipNumber-1])[1]]; 121 | } 122 | else{ 123 | [layer setBackLayerContent:JHFlip_make_hsplit_images_for_view(viewArray[a-1])[1]]; 124 | } 125 | layer.hidden = YES; 126 | //[self.view.layer insertSublayer:layer below:self.view.layer]; 127 | [self.layer addSublayer:layer]; 128 | layer.rotateDegree = 0.0f; 129 | [layerHelperArray addObject:layer]; 130 | } 131 | _bottom_layer = [layerHelperArray objectAtIndex:_currentPage]; 132 | _bottom_layer.hidden = NO; 133 | // _bottom_layer.transform = CATransform3DMakeRotation(M_PI, 1, 0, 0); 134 | for (int a=(int)_flipNumber-1; a>=0; a--) { 135 | CustomLayer* layer=[[CustomLayer alloc]initWithFrame:layerFrame]; 136 | [layer setFrontLayerContent:JHFlip_make_hsplit_images_for_view(viewArray[a])[0]]; 137 | [bottomViewArray addObject:JHFlip_make_hsplit_images_for_view(viewArray[a])[1]]; 138 | if (a == 0) { 139 | [layer setBackLayerContent:JHFlip_make_hsplit_images_for_view(viewArray[_flipNumber-1])[1]]; 140 | } 141 | else{ 142 | [layer setBackLayerContent:JHFlip_make_hsplit_images_for_view(viewArray[a-1])[1]]; 143 | } 144 | layer.hidden = YES; 145 | //[self.view.layer insertSublayer:layer below:self.view.layer]; 146 | [self.layer addSublayer:layer]; 147 | layer.rotateDegree = 0.0f; 148 | [layerArray addObject:layer]; 149 | _dragging_layer = layer; 150 | } 151 | _dragging_layer = [layerHelperArray objectAtIndex:_currentPage]; 152 | _dragging_layer.hidden = NO; 153 | } 154 | -(void)timerFired 155 | { 156 | //[_dragging_layer removeAllAnimations]; 157 | _dragging_layer = [layerArray objectAtIndex:_currentPage]; 158 | _currentPage = (_currentPage+1)%_flipNumber; 159 | _dragging_layer.hidden = NO; 160 | [_dragging_layer addAnimation:[self rotation:0.5 degree:kDegreesToRadian ( 180 ) direction:1 repeatCount:0] forKey:@"transform"]; 161 | } 162 | 163 | -( CABasicAnimation *)rotation:( float )dur degree:( float )degree direction:( int )direction repeatCount:( int )repeatCount 164 | 165 | { 166 | //[CATransaction begin]; 167 | CABasicAnimation *animation = [ CABasicAnimation animationWithKeyPath : @"transform" ]; 168 | 169 | //animation. toValue = [ NSValue valueWithCATransform3D :rotationTransform]; 170 | animation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(0, 1, 0, 0)]; 171 | animation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI, 1, 0, 0)]; 172 | animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 173 | animation. duration = dur; 174 | 175 | //这两句是保持移动后保持不变 176 | animation.removedOnCompletion = NO; 177 | animation.fillMode = kCAFillModeForwards; 178 | animation. delegate = self ; 179 | return animation; 180 | 181 | } 182 | 183 | - (void)animationDidStart:(CAAnimation *)anim 184 | { 185 | _next_layer = [layerArray objectAtIndex:_currentPage]; 186 | _next_layer.transform = CATransform3DMakeRotation(0, 1, 0, 0); 187 | _next_layer.hidden = NO; 188 | 189 | _bottom_layer.hidden = NO; 190 | [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(here) userInfo:nil repeats:NO]; 191 | } 192 | 193 | - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag; 194 | { 195 | [self bringSubviewToFront:_bottomImageView]; 196 | 197 | _bottom_layer = [layerHelperArray objectAtIndex:(_currentPage-1+_flipNumber)%_flipNumber]; 198 | _bottom_layer.transform = CATransform3DMakeRotation(0, 1, 0, 0); 199 | ((CustomLayer*)[layerHelperArray objectAtIndex:_currentPage]).hidden = YES; 200 | ((CustomLayer*)[layerHelperArray objectAtIndex:_currentPage]).transform = CATransform3DMakeRotation(M_PI, 1, 0, 0); 201 | 202 | [_dragging_layer removeAnimationForKey: @"transform"]; 203 | _dragging_layer.hidden = YES; 204 | 205 | 206 | } 207 | 208 | -(void)here { 209 | _bottomImageView.image = nil; 210 | _bottomImageView.image = bottomViewArray[_currentPage]; 211 | } 212 | 213 | @end 214 | -------------------------------------------------------------------------------- /ForFlipCountDownDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ForFlipCountDownDemo 4 | // 5 | // Created by DamonNG on 15/7/3. 6 | // Copyright (c) 2015年 JiehaoWu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ForFlipCountDownDemoTests/ForFlipCountDownDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ForFlipCountDownDemoTests.m 3 | // ForFlipCountDownDemoTests 4 | // 5 | // Created by DamonNG on 15/7/3. 6 | // Copyright (c) 2015年 JiehaoWu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface ForFlipCountDownDemoTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation ForFlipCountDownDemoTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /ForFlipCountDownDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | sohu.$(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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ForFlipCountDownDemo 2 | 3 | 使用了CALayer框架来做出3D翻页效果的倒计时demo。 4 |

5 | # 效果图: 6 | 7 | ![](http://s12.sinaimg.cn/mw690/0028NHt6gy6TAwZS09teb&690) 8 | 9 |

10 | # How to use: 11 | 12 | 使用起来非常简单: 13 |
(1)引入头文件:“#import "JHFlipCountDownView.h"”; 14 |
(2)调用JHFlipCountDownView类的一个接口:-(id)initWithFrame:(CGRect)frame countDownType:(COUNT_DOWN_TYPE)countDowntype countDownTime:(NSDate *)countDownTime; 15 | 16 |
代码如下: 17 |
18 |
JHFlipCountDownView *flipCountDownView = [[JHFlipCountDownView alloc] initWithFrame:CGRectMake((self.view.frame.size.width-320)/2, 150, 320, 80) countDownType:TYPE_HHmmss countDownTime:[self p_haveTime]]; 19 |
[self.view addSubview:flipCountDownView]; 20 | 21 |
以上代码就已经把倒计时View加入了UI。 22 | 23 |
(3)最后,开启倒计时,[flipCountDownView startCountDown]; 24 | 25 |
使用就是这么简单!!! 26 |
27 | 28 | # Tip 29 | 30 | 使用了CALayer框架来搞,页面在翻转的过程中,你会发现翻过来的同时,背面也有数字。 31 | 这是双层的layer,这里有一个小技巧就是,如何创建一个双层的layer? 32 | 还有注意的是layer有一个属性,叫doubleSide,意思是背部可见吗? 33 | 创建双层layer的方法在我源码的CustomLayer这个类里面。 34 | 35 |

36 | 欢迎大家对本人的demo提意见哈。 37 | --------------------------------------------------------------------------------