├── .DS_Store ├── .gitignore ├── JKCountDownButton.podspec ├── JKCountDownButton.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── JKCountDownButton ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ └── LaunchScreen.xib ├── DemoViewController.h ├── DemoViewController.m ├── DemoViewController.xib ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── JKCountDownButton │ ├── JKCountDownButton.h │ └── JKCountDownButton.m ├── RootViewController.h ├── RootViewController.m ├── RootViewController.xib └── main.m ├── LICENSE ├── README.md └── demo.gif /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaojiankui/JKCountDownButton/c8708aa3a639a5932e5c6de74b39bcfeafa9c422/.DS_Store -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /JKCountDownButton.podspec: -------------------------------------------------------------------------------- 1 | version = "1.3.0"; 2 | 3 | Pod::Spec.new do |s| 4 | s.name = "JKCountDownButton" 5 | s.version = version 6 | s.summary = "JKCountDownButton, subclassing UIButton implementation iOS countdown button, register with sending the verification code and countdown" 7 | s.homepage = "https://github.com/shaojiankui/JKCountDownButton" 8 | s.license = { :type => "MIT", :file => "LICENSE" } 9 | s.author = { "skyfox" => "i@skyfox.org" } 10 | s.social_media_url = "http://www.skyfox.org" 11 | s.platform = :ios,"6.0" 12 | s.requires_arc = true 13 | s.source = { :git => "https://github.com/shaojiankui/JKCountDownButton.git", :tag => "#{version}" } 14 | s.source_files = "JKCountDownButton/JKCountDownButton/JKCountDownButton.{h,m}" 15 | end -------------------------------------------------------------------------------- /JKCountDownButton.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A2A7C4CF1AABFE1D003C78DF /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A7C4CE1AABFE1D003C78DF /* main.m */; }; 11 | A2A7C4D21AABFE1D003C78DF /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A7C4D11AABFE1D003C78DF /* AppDelegate.m */; }; 12 | A2A7C4DA1AABFE1D003C78DF /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A2A7C4D91AABFE1D003C78DF /* Images.xcassets */; }; 13 | A2A7C4DD1AABFE1D003C78DF /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = A2A7C4DB1AABFE1D003C78DF /* LaunchScreen.xib */; }; 14 | A2A7C4F51AABFE63003C78DF /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A7C4F31AABFE63003C78DF /* RootViewController.m */; }; 15 | A2A7C4F61AABFE63003C78DF /* RootViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A2A7C4F41AABFE63003C78DF /* RootViewController.xib */; }; 16 | A2A7C4FA1AABFEA7003C78DF /* JKCountDownButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A7C4F91AABFEA7003C78DF /* JKCountDownButton.m */; }; 17 | B8D356C121525252004E5E19 /* DemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B8D356BE21525250004E5E19 /* DemoViewController.m */; }; 18 | B8D356C221525252004E5E19 /* DemoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = B8D356BF21525251004E5E19 /* DemoViewController.xib */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | A2A7C4C91AABFE1D003C78DF /* JKCountDownButton.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JKCountDownButton.app; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | A2A7C4CD1AABFE1D003C78DF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 24 | A2A7C4CE1AABFE1D003C78DF /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 25 | A2A7C4D01AABFE1D003C78DF /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 26 | A2A7C4D11AABFE1D003C78DF /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 27 | A2A7C4D91AABFE1D003C78DF /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 28 | A2A7C4DC1AABFE1D003C78DF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 29 | A2A7C4F21AABFE63003C78DF /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; 30 | A2A7C4F31AABFE63003C78DF /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RootViewController.m; sourceTree = ""; }; 31 | A2A7C4F41AABFE63003C78DF /* RootViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RootViewController.xib; sourceTree = ""; }; 32 | A2A7C4F81AABFEA7003C78DF /* JKCountDownButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JKCountDownButton.h; sourceTree = ""; }; 33 | A2A7C4F91AABFEA7003C78DF /* JKCountDownButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JKCountDownButton.m; sourceTree = ""; }; 34 | B8D356BE21525250004E5E19 /* DemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoViewController.m; sourceTree = ""; }; 35 | B8D356BF21525251004E5E19 /* DemoViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DemoViewController.xib; sourceTree = ""; }; 36 | B8D356C021525252004E5E19 /* DemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoViewController.h; sourceTree = ""; }; 37 | /* End PBXFileReference section */ 38 | 39 | /* Begin PBXFrameworksBuildPhase section */ 40 | A2A7C4C61AABFE1D003C78DF /* Frameworks */ = { 41 | isa = PBXFrameworksBuildPhase; 42 | buildActionMask = 2147483647; 43 | files = ( 44 | ); 45 | runOnlyForDeploymentPostprocessing = 0; 46 | }; 47 | /* End PBXFrameworksBuildPhase section */ 48 | 49 | /* Begin PBXGroup section */ 50 | A2A7C4C01AABFE1D003C78DF = { 51 | isa = PBXGroup; 52 | children = ( 53 | A2A7C4CB1AABFE1D003C78DF /* JKCountDownButton */, 54 | A2A7C4CA1AABFE1D003C78DF /* Products */, 55 | ); 56 | sourceTree = ""; 57 | }; 58 | A2A7C4CA1AABFE1D003C78DF /* Products */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | A2A7C4C91AABFE1D003C78DF /* JKCountDownButton.app */, 62 | ); 63 | name = Products; 64 | sourceTree = ""; 65 | }; 66 | A2A7C4CB1AABFE1D003C78DF /* JKCountDownButton */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | A2A7C4F71AABFE93003C78DF /* JKCountDownButton */, 70 | A2A7C4D01AABFE1D003C78DF /* AppDelegate.h */, 71 | A2A7C4D11AABFE1D003C78DF /* AppDelegate.m */, 72 | A2A7C4F21AABFE63003C78DF /* RootViewController.h */, 73 | A2A7C4F31AABFE63003C78DF /* RootViewController.m */, 74 | A2A7C4F41AABFE63003C78DF /* RootViewController.xib */, 75 | B8D356C021525252004E5E19 /* DemoViewController.h */, 76 | B8D356BE21525250004E5E19 /* DemoViewController.m */, 77 | B8D356BF21525251004E5E19 /* DemoViewController.xib */, 78 | A2A7C4D91AABFE1D003C78DF /* Images.xcassets */, 79 | A2A7C4DB1AABFE1D003C78DF /* LaunchScreen.xib */, 80 | A2A7C4CC1AABFE1D003C78DF /* Supporting Files */, 81 | ); 82 | path = JKCountDownButton; 83 | sourceTree = ""; 84 | }; 85 | A2A7C4CC1AABFE1D003C78DF /* Supporting Files */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | A2A7C4CD1AABFE1D003C78DF /* Info.plist */, 89 | A2A7C4CE1AABFE1D003C78DF /* main.m */, 90 | ); 91 | name = "Supporting Files"; 92 | sourceTree = ""; 93 | }; 94 | A2A7C4F71AABFE93003C78DF /* JKCountDownButton */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | A2A7C4F81AABFEA7003C78DF /* JKCountDownButton.h */, 98 | A2A7C4F91AABFEA7003C78DF /* JKCountDownButton.m */, 99 | ); 100 | path = JKCountDownButton; 101 | sourceTree = ""; 102 | }; 103 | /* End PBXGroup section */ 104 | 105 | /* Begin PBXNativeTarget section */ 106 | A2A7C4C81AABFE1D003C78DF /* JKCountDownButton */ = { 107 | isa = PBXNativeTarget; 108 | buildConfigurationList = A2A7C4EC1AABFE1E003C78DF /* Build configuration list for PBXNativeTarget "JKCountDownButton" */; 109 | buildPhases = ( 110 | A2A7C4C51AABFE1D003C78DF /* Sources */, 111 | A2A7C4C61AABFE1D003C78DF /* Frameworks */, 112 | A2A7C4C71AABFE1D003C78DF /* Resources */, 113 | ); 114 | buildRules = ( 115 | ); 116 | dependencies = ( 117 | ); 118 | name = JKCountDownButton; 119 | productName = JKCountDownButton; 120 | productReference = A2A7C4C91AABFE1D003C78DF /* JKCountDownButton.app */; 121 | productType = "com.apple.product-type.application"; 122 | }; 123 | /* End PBXNativeTarget section */ 124 | 125 | /* Begin PBXProject section */ 126 | A2A7C4C11AABFE1D003C78DF /* Project object */ = { 127 | isa = PBXProject; 128 | attributes = { 129 | LastUpgradeCheck = 0730; 130 | ORGANIZATIONNAME = www.skyfox.org; 131 | TargetAttributes = { 132 | A2A7C4C81AABFE1D003C78DF = { 133 | CreatedOnToolsVersion = 6.1.1; 134 | }; 135 | }; 136 | }; 137 | buildConfigurationList = A2A7C4C41AABFE1D003C78DF /* Build configuration list for PBXProject "JKCountDownButton" */; 138 | compatibilityVersion = "Xcode 3.2"; 139 | developmentRegion = English; 140 | hasScannedForEncodings = 0; 141 | knownRegions = ( 142 | en, 143 | Base, 144 | ); 145 | mainGroup = A2A7C4C01AABFE1D003C78DF; 146 | productRefGroup = A2A7C4CA1AABFE1D003C78DF /* Products */; 147 | projectDirPath = ""; 148 | projectRoot = ""; 149 | targets = ( 150 | A2A7C4C81AABFE1D003C78DF /* JKCountDownButton */, 151 | ); 152 | }; 153 | /* End PBXProject section */ 154 | 155 | /* Begin PBXResourcesBuildPhase section */ 156 | A2A7C4C71AABFE1D003C78DF /* Resources */ = { 157 | isa = PBXResourcesBuildPhase; 158 | buildActionMask = 2147483647; 159 | files = ( 160 | A2A7C4DD1AABFE1D003C78DF /* LaunchScreen.xib in Resources */, 161 | A2A7C4DA1AABFE1D003C78DF /* Images.xcassets in Resources */, 162 | A2A7C4F61AABFE63003C78DF /* RootViewController.xib in Resources */, 163 | B8D356C221525252004E5E19 /* DemoViewController.xib in Resources */, 164 | ); 165 | runOnlyForDeploymentPostprocessing = 0; 166 | }; 167 | /* End PBXResourcesBuildPhase section */ 168 | 169 | /* Begin PBXSourcesBuildPhase section */ 170 | A2A7C4C51AABFE1D003C78DF /* Sources */ = { 171 | isa = PBXSourcesBuildPhase; 172 | buildActionMask = 2147483647; 173 | files = ( 174 | A2A7C4FA1AABFEA7003C78DF /* JKCountDownButton.m in Sources */, 175 | A2A7C4D21AABFE1D003C78DF /* AppDelegate.m in Sources */, 176 | A2A7C4CF1AABFE1D003C78DF /* main.m in Sources */, 177 | B8D356C121525252004E5E19 /* DemoViewController.m in Sources */, 178 | A2A7C4F51AABFE63003C78DF /* RootViewController.m in Sources */, 179 | ); 180 | runOnlyForDeploymentPostprocessing = 0; 181 | }; 182 | /* End PBXSourcesBuildPhase section */ 183 | 184 | /* Begin PBXVariantGroup section */ 185 | A2A7C4DB1AABFE1D003C78DF /* LaunchScreen.xib */ = { 186 | isa = PBXVariantGroup; 187 | children = ( 188 | A2A7C4DC1AABFE1D003C78DF /* Base */, 189 | ); 190 | name = LaunchScreen.xib; 191 | sourceTree = ""; 192 | }; 193 | /* End PBXVariantGroup section */ 194 | 195 | /* Begin XCBuildConfiguration section */ 196 | A2A7C4EA1AABFE1E003C78DF /* Debug */ = { 197 | isa = XCBuildConfiguration; 198 | buildSettings = { 199 | ALWAYS_SEARCH_USER_PATHS = NO; 200 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 201 | CLANG_CXX_LIBRARY = "libc++"; 202 | CLANG_ENABLE_MODULES = YES; 203 | CLANG_ENABLE_OBJC_ARC = YES; 204 | CLANG_WARN_BOOL_CONVERSION = YES; 205 | CLANG_WARN_CONSTANT_CONVERSION = YES; 206 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 207 | CLANG_WARN_EMPTY_BODY = YES; 208 | CLANG_WARN_ENUM_CONVERSION = YES; 209 | CLANG_WARN_INT_CONVERSION = YES; 210 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 211 | CLANG_WARN_UNREACHABLE_CODE = YES; 212 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 213 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 214 | COPY_PHASE_STRIP = NO; 215 | ENABLE_STRICT_OBJC_MSGSEND = YES; 216 | ENABLE_TESTABILITY = YES; 217 | GCC_C_LANGUAGE_STANDARD = gnu99; 218 | GCC_DYNAMIC_NO_PIC = NO; 219 | GCC_OPTIMIZATION_LEVEL = 0; 220 | GCC_PREPROCESSOR_DEFINITIONS = ( 221 | "DEBUG=1", 222 | "$(inherited)", 223 | ); 224 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 225 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 226 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 227 | GCC_WARN_UNDECLARED_SELECTOR = YES; 228 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 229 | GCC_WARN_UNUSED_FUNCTION = YES; 230 | GCC_WARN_UNUSED_VARIABLE = YES; 231 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 232 | MTL_ENABLE_DEBUG_INFO = YES; 233 | ONLY_ACTIVE_ARCH = YES; 234 | SDKROOT = iphoneos; 235 | }; 236 | name = Debug; 237 | }; 238 | A2A7C4EB1AABFE1E003C78DF /* Release */ = { 239 | isa = XCBuildConfiguration; 240 | buildSettings = { 241 | ALWAYS_SEARCH_USER_PATHS = NO; 242 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 243 | CLANG_CXX_LIBRARY = "libc++"; 244 | CLANG_ENABLE_MODULES = YES; 245 | CLANG_ENABLE_OBJC_ARC = YES; 246 | CLANG_WARN_BOOL_CONVERSION = YES; 247 | CLANG_WARN_CONSTANT_CONVERSION = YES; 248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INT_CONVERSION = YES; 252 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 253 | CLANG_WARN_UNREACHABLE_CODE = YES; 254 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 255 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 256 | COPY_PHASE_STRIP = YES; 257 | ENABLE_NS_ASSERTIONS = NO; 258 | ENABLE_STRICT_OBJC_MSGSEND = YES; 259 | GCC_C_LANGUAGE_STANDARD = gnu99; 260 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 261 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 262 | GCC_WARN_UNDECLARED_SELECTOR = YES; 263 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 264 | GCC_WARN_UNUSED_FUNCTION = YES; 265 | GCC_WARN_UNUSED_VARIABLE = YES; 266 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 267 | MTL_ENABLE_DEBUG_INFO = NO; 268 | SDKROOT = iphoneos; 269 | VALIDATE_PRODUCT = YES; 270 | }; 271 | name = Release; 272 | }; 273 | A2A7C4ED1AABFE1E003C78DF /* Debug */ = { 274 | isa = XCBuildConfiguration; 275 | buildSettings = { 276 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 277 | INFOPLIST_FILE = JKCountDownButton/Info.plist; 278 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 279 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 280 | PRODUCT_BUNDLE_IDENTIFIER = "org.skyfox.$(PRODUCT_NAME:rfc1034identifier)"; 281 | PRODUCT_NAME = "$(TARGET_NAME)"; 282 | }; 283 | name = Debug; 284 | }; 285 | A2A7C4EE1AABFE1E003C78DF /* Release */ = { 286 | isa = XCBuildConfiguration; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | INFOPLIST_FILE = JKCountDownButton/Info.plist; 290 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 291 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 292 | PRODUCT_BUNDLE_IDENTIFIER = "org.skyfox.$(PRODUCT_NAME:rfc1034identifier)"; 293 | PRODUCT_NAME = "$(TARGET_NAME)"; 294 | }; 295 | name = Release; 296 | }; 297 | /* End XCBuildConfiguration section */ 298 | 299 | /* Begin XCConfigurationList section */ 300 | A2A7C4C41AABFE1D003C78DF /* Build configuration list for PBXProject "JKCountDownButton" */ = { 301 | isa = XCConfigurationList; 302 | buildConfigurations = ( 303 | A2A7C4EA1AABFE1E003C78DF /* Debug */, 304 | A2A7C4EB1AABFE1E003C78DF /* Release */, 305 | ); 306 | defaultConfigurationIsVisible = 0; 307 | defaultConfigurationName = Release; 308 | }; 309 | A2A7C4EC1AABFE1E003C78DF /* Build configuration list for PBXNativeTarget "JKCountDownButton" */ = { 310 | isa = XCConfigurationList; 311 | buildConfigurations = ( 312 | A2A7C4ED1AABFE1E003C78DF /* Debug */, 313 | A2A7C4EE1AABFE1E003C78DF /* Release */, 314 | ); 315 | defaultConfigurationIsVisible = 0; 316 | defaultConfigurationName = Release; 317 | }; 318 | /* End XCConfigurationList section */ 319 | }; 320 | rootObject = A2A7C4C11AABFE1D003C78DF /* Project object */; 321 | } 322 | -------------------------------------------------------------------------------- /JKCountDownButton.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JKCountDownButton/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // JKCountDownButton 4 | // 5 | // Created by Jakey on 15/3/8. 6 | // Copyright (c) 2015年 www.skyfox.org. All rights reserved. 7 | // 8 | 9 | #import 10 | @class RootViewController; 11 | @interface AppDelegate : UIResponder 12 | @property (strong, nonatomic) UIWindow *window; 13 | @property (strong, nonatomic) RootViewController *rooViewController; 14 | @property (strong, nonatomic) UINavigationController *navgationController; 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /JKCountDownButton/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // JKCountDownButton 4 | // 5 | // Created by Jakey on 15/3/8. 6 | // Copyright (c) 2015年 www.skyfox.org. All rights reserved. 7 | // 8 | 9 | 10 | #import "AppDelegate.h" 11 | #import "RootViewController.h" 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 20 | { 21 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 22 | // Override point for customization after application launch. 23 | self.window.backgroundColor = [UIColor whiteColor]; 24 | self.rooViewController = [[RootViewController alloc] init]; 25 | self.navgationController = [[UINavigationController alloc]initWithRootViewController:self.rooViewController]; 26 | self.window.rootViewController = self.navgationController; 27 | [self.window makeKeyAndVisible]; 28 | return YES; 29 | } 30 | 31 | - (void)applicationWillResignActive:(UIApplication *)application { 32 | // 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. 33 | // 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. 34 | } 35 | 36 | - (void)applicationDidEnterBackground:(UIApplication *)application { 37 | // 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. 38 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 39 | } 40 | 41 | - (void)applicationWillEnterForeground:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | - (void)applicationDidBecomeActive:(UIApplication *)application { 46 | // 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. 47 | } 48 | 49 | - (void)applicationWillTerminate:(UIApplication *)application { 50 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /JKCountDownButton/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 | -------------------------------------------------------------------------------- /JKCountDownButton/DemoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DemoViewController.h 3 | // JKCountDownButton 4 | // 5 | // Created by runlin on 2018/9/19. 6 | // Copyright © 2018年 www.skyfox.org. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JKCountDownButton.h" 11 | 12 | @interface DemoViewController : UIViewController 13 | //xib 方式 14 | @property (weak, nonatomic) IBOutlet JKCountDownButton *countDownXib; 15 | - (IBAction)countDownXibTouched:(JKCountDownButton*)sender; 16 | @end 17 | -------------------------------------------------------------------------------- /JKCountDownButton/DemoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DemoViewController.m 3 | // JKCountDownButton 4 | // 5 | // Created by runlin on 2018/9/19. 6 | // Copyright © 2018年 www.skyfox.org. All rights reserved. 7 | // 8 | 9 | #import "DemoViewController.h" 10 | 11 | @interface DemoViewController () 12 | 13 | @end 14 | 15 | @implementation DemoViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view from its nib. 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | - (IBAction)countDownXibTouched:(JKCountDownButton*)sender { 27 | sender.enabled = NO; 28 | //button type要 设置成custom 否则会闪动 29 | [sender startCountDownWithSecond:20]; 30 | 31 | [sender countDownChanging:^NSString *(JKCountDownButton *countDownButton,NSUInteger second) { 32 | NSString *title = [NSString stringWithFormat:@"剩余%zd秒",second]; 33 | NSLog(@"countDownChanging:%@",title); 34 | return title; 35 | }]; 36 | [sender countDownFinished:^NSString *(JKCountDownButton *countDownButton, NSUInteger second) { 37 | countDownButton.enabled = YES; 38 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"倒计时完成" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil]; 39 | [alert show]; 40 | NSLog(@"countDownFinished:倒计时完成"); 41 | return @"点击重新获取"; 42 | 43 | }]; 44 | } 45 | 46 | /* 47 | #pragma mark - Navigation 48 | 49 | // In a storyboard-based application, you will often want to do a little preparation before navigation 50 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 51 | // Get the new view controller using [segue destinationViewController]. 52 | // Pass the selected object to the new view controller. 53 | } 54 | */ 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /JKCountDownButton/DemoViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 30 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /JKCountDownButton/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /JKCountDownButton/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /JKCountDownButton/JKCountDownButton/JKCountDownButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // JKCountDownButton.h 3 | // JKCountDownButton 4 | // 5 | // Created by Jakey on 15/3/8. 6 | // Copyright (c) 2015年 www.skyfox.org. All rights reserved. 7 | // 8 | 9 | #import 10 | @class JKCountDownButton; 11 | typedef NSString* (^CountDownChanging)(JKCountDownButton *countDownButton,NSUInteger second); 12 | typedef NSString* (^CountDownFinished)(JKCountDownButton *countDownButton,NSUInteger second); 13 | typedef void (^TouchedCountDownButtonHandler)(JKCountDownButton *countDownButton,NSInteger tag); 14 | 15 | @interface JKCountDownButton : UIButton 16 | @property(nonatomic,strong) id userInfo; 17 | ///倒计时按钮点击回调 18 | - (void)countDownButtonHandler:(TouchedCountDownButtonHandler)touchedCountDownButtonHandler; 19 | //倒计时时间改变回调 20 | - (void)countDownChanging:(CountDownChanging)countDownChanging; 21 | //倒计时结束回调 22 | - (void)countDownFinished:(CountDownFinished)countDownFinished; 23 | ///开始倒计时 24 | - (void)startCountDownWithSecond:(NSUInteger)second; 25 | ///停止倒计时 26 | - (void)stopCountDown; 27 | @end 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /JKCountDownButton/JKCountDownButton/JKCountDownButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // JKCountDownButton.m 3 | // JKCountDownButton 4 | // 5 | // Created by Jakey on 15/3/8. 6 | // Copyright (c) 2015年 www.skyfox.org. All rights reserved. 7 | // 8 | 9 | #import "JKCountDownButton.h" 10 | @interface NSTimer (JKCountDownBlocksSupport) 11 | + (NSTimer *)jkcd_scheduledTimerWithTimeInterval:(NSTimeInterval)interval 12 | block:(void(^)(void))block 13 | repeats:(BOOL)repeats; 14 | @end 15 | 16 | 17 | @interface JKCountDownButton(){ 18 | NSInteger _second; 19 | NSUInteger _totalSecond; 20 | 21 | NSTimer *_timer; 22 | NSDate *_startDate; 23 | 24 | CountDownChanging _countDownChanging; 25 | CountDownFinished _countDownFinished; 26 | TouchedCountDownButtonHandler _touchedCountDownButtonHandler; 27 | } 28 | @end 29 | 30 | @implementation JKCountDownButton 31 | #pragma -mark touche action 32 | - (void)countDownButtonHandler:(TouchedCountDownButtonHandler)touchedCountDownButtonHandler{ 33 | _touchedCountDownButtonHandler = [touchedCountDownButtonHandler copy]; 34 | [self addTarget:self action:@selector(touched:) forControlEvents:UIControlEventTouchUpInside]; 35 | } 36 | 37 | - (void)touched:(JKCountDownButton*)sender{ 38 | if (_touchedCountDownButtonHandler) { 39 | dispatch_async(dispatch_get_main_queue(), ^{ 40 | _touchedCountDownButtonHandler(sender,sender.tag); 41 | }); 42 | } 43 | } 44 | 45 | #pragma -mark count down method 46 | - (void)startCountDownWithSecond:(NSUInteger)totalSecond 47 | { 48 | _totalSecond = totalSecond; 49 | _second = totalSecond; 50 | 51 | 52 | __weak typeof(self) weakSelf = self; 53 | _timer = [NSTimer jkcd_scheduledTimerWithTimeInterval:1.0 block:^{ 54 | typeof(weakSelf) strongSelf = weakSelf; 55 | [strongSelf timerStart]; 56 | } repeats:YES]; 57 | 58 | _startDate = [NSDate date]; 59 | _timer.fireDate = [NSDate distantPast]; 60 | [[NSRunLoop currentRunLoop]addTimer:_timer forMode:NSRunLoopCommonModes]; 61 | } 62 | - (void)timerStart { 63 | double deltaTime = [[NSDate date] timeIntervalSinceDate:_startDate]; 64 | 65 | _second = _totalSecond - (NSInteger)(deltaTime+0.5) ; 66 | 67 | 68 | if (_second< 0.0) 69 | { 70 | [self stopCountDown]; 71 | } 72 | else 73 | { 74 | if (_countDownChanging) 75 | { 76 | dispatch_async(dispatch_get_main_queue(), ^{ 77 | NSString *title = _countDownChanging(self,_second); 78 | [self setTitle:title forState:UIControlStateNormal]; 79 | [self setTitle:title forState:UIControlStateDisabled]; 80 | }); 81 | } 82 | else 83 | { 84 | NSString *title = [NSString stringWithFormat:@"%zd秒",_second]; 85 | [self setTitle:title forState:UIControlStateNormal]; 86 | [self setTitle:title forState:UIControlStateDisabled]; 87 | 88 | } 89 | } 90 | } 91 | 92 | - (void)stopCountDown{ 93 | if (_timer) { 94 | if ([_timer respondsToSelector:@selector(isValid)]) 95 | { 96 | if ([_timer isValid]) 97 | { 98 | [_timer invalidate]; 99 | _second = _totalSecond; 100 | if (_countDownFinished) 101 | { 102 | dispatch_async(dispatch_get_main_queue(), ^{ 103 | NSString *title = _countDownFinished(self,_totalSecond); 104 | [self setTitle:title forState:UIControlStateNormal]; 105 | [self setTitle:title forState:UIControlStateDisabled]; 106 | }); 107 | } 108 | else 109 | { 110 | [self setTitle:@"重新获取" forState:UIControlStateNormal]; 111 | [self setTitle:@"重新获取" forState:UIControlStateDisabled]; 112 | 113 | } 114 | } 115 | } 116 | } 117 | } 118 | #pragma -mark block 119 | - (void)countDownChanging:(CountDownChanging)countDownChanging{ 120 | _countDownChanging = [countDownChanging copy]; 121 | } 122 | - (void)countDownFinished:(CountDownFinished)countDownFinished{ 123 | _countDownFinished = [countDownFinished copy]; 124 | } 125 | @end 126 | 127 | 128 | @implementation NSTimer (JKCountDownBlocksSupport) 129 | + (NSTimer *)jkcd_scheduledTimerWithTimeInterval:(NSTimeInterval)interval 130 | block:(void(^)(void))block 131 | repeats:(BOOL)repeats 132 | { 133 | return [self scheduledTimerWithTimeInterval:interval 134 | target:self 135 | selector:@selector(jkcd_blockInvoke:) 136 | userInfo:[block copy] 137 | repeats:repeats]; 138 | } 139 | + (void)jkcd_blockInvoke:(NSTimer *)timer { 140 | void (^block)(void) = timer.userInfo; 141 | if(block) { 142 | block(); 143 | } 144 | } 145 | @end 146 | -------------------------------------------------------------------------------- /JKCountDownButton/RootViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.h 3 | // JKCountDownButton 4 | // 5 | // Created by Jakey on 15/3/8. 6 | // Copyright (c) 2015年 www.skyfox.org. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JKCountDownButton.h" 11 | @interface RootViewController : UIViewController 12 | { 13 | JKCountDownButton *_countDownCode; 14 | } 15 | //xib 方式 16 | @property (weak, nonatomic) IBOutlet JKCountDownButton *countDownXib; 17 | - (IBAction)countDownXibTouched:(JKCountDownButton*)sender; 18 | - (IBAction)countDownXibStop:(id)sender; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /JKCountDownButton/RootViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.m 3 | // JKCountDownButton 4 | // 5 | // Created by Jakey on 15/3/8. 6 | // Copyright (c) 2015年 www.skyfox.org. All rights reserved. 7 | // 8 | 9 | #import "RootViewController.h" 10 | #import "DemoViewController.h" 11 | @interface RootViewController () 12 | 13 | @end 14 | 15 | @implementation RootViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view from its nib. 20 | 21 | [self buildCountDown]; 22 | 23 | } 24 | - (void)buildCountDown{ 25 | UILabel *lable = [[UILabel alloc]initWithFrame:CGRectMake(10, 200, 70, 32)]; 26 | lable.text = @"代码添加"; 27 | lable.textColor = [UIColor whiteColor]; 28 | [self.view addSubview:lable]; 29 | 30 | 31 | _countDownCode = [JKCountDownButton buttonWithType:UIButtonTypeCustom]; 32 | _countDownCode.frame = CGRectMake(81, 200, 108, 32); 33 | [_countDownCode setTitle:@"开始" forState:UIControlStateNormal]; 34 | _countDownCode.backgroundColor = [UIColor blueColor]; 35 | [self.view addSubview:_countDownCode]; 36 | 37 | 38 | [_countDownCode countDownButtonHandler:^(JKCountDownButton*sender, NSInteger tag) { 39 | sender.enabled = NO; 40 | 41 | [sender startCountDownWithSecond:10]; 42 | 43 | [sender countDownChanging:^NSString *(JKCountDownButton *countDownButton,NSUInteger second) { 44 | NSString *title = [NSString stringWithFormat:@"剩余%zd秒",second]; 45 | return title; 46 | }]; 47 | [sender countDownFinished:^NSString *(JKCountDownButton *countDownButton, NSUInteger second) { 48 | countDownButton.enabled = YES; 49 | return @"点击重新获取"; 50 | 51 | }]; 52 | 53 | }]; 54 | } 55 | 56 | - (IBAction)countDownXibTouched:(JKCountDownButton*)sender { 57 | sender.enabled = NO; 58 | //button type要 设置成custom 否则会闪动 59 | [sender startCountDownWithSecond:60]; 60 | 61 | [sender countDownChanging:^NSString *(JKCountDownButton *countDownButton,NSUInteger second) { 62 | NSString *title = [NSString stringWithFormat:@"剩余%zd秒",second]; 63 | return title; 64 | }]; 65 | [sender countDownFinished:^NSString *(JKCountDownButton *countDownButton, NSUInteger second) { 66 | countDownButton.enabled = YES; 67 | return @"点击重新获取"; 68 | 69 | }]; 70 | } 71 | 72 | - (IBAction)countDownXibStop:(id)sender { 73 | [self.countDownXib stopCountDown]; 74 | [_countDownCode stopCountDown]; 75 | } 76 | - (IBAction)pushTouched:(id)sender { 77 | DemoViewController *demo = [[DemoViewController alloc] init]; 78 | [self.navigationController pushViewController:demo animated:YES]; 79 | } 80 | @end 81 | -------------------------------------------------------------------------------- /JKCountDownButton/RootViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 30 | 40 | 57 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /JKCountDownButton/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // JKCountDownButton 4 | // 5 | // Created by Jakey on 15/3/8. 6 | // Copyright (c) 2015年 www.skyfox.org. 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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 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. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JKCountDownButton 2 | JKCountDownButton,子类化UIButton实现IOS倒计时按钮,常常用于注册等发送验证码的时候进行倒计时操作 3 | 4 | JKCountDownButton, subclassing UIButton implementation iOS countdown button, register with sending the verification code and countdown 5 | 6 | ## Installation 7 | 8 | ### Installation with CocoaPods 9 | 10 | platform :ios 11 | pod 'JKCountDownButton' 12 | 13 | ### Manually 14 | 15 | Copy JKCountDownButton.h JKCountDownButton.m in JKCountDownButton/ to your project. 16 | 17 | ## Usage 18 | ### Code 19 | JKCountDownButton *_countDownCode; 20 | _countDownCode = [JKCountDownButton buttonWithType:UIButtonTypeCustom]; 21 | _countDownCode.frame = CGRectMake(81, 200, 108, 32); 22 | [_countDownCode setTitle:@"开始" forState:UIControlStateNormal]; 23 | _countDownCode.backgroundColor = [UIColor blueColor]; 24 | [self.view addSubview:_countDownCode]; 25 | 26 | [_countDownCode countDownButtonHandler:^(JKCountDownButton*sender, NSInteger tag) { 27 | sender.enabled = NO; 28 | 29 | [sender startCountDownWithSecond:10]; 30 | 31 | [sender countDownChanging:^NSString *(JKCountDownButton *countDownButton,NSUInteger second) { 32 | NSString *title = [NSString stringWithFormat:@"剩余%zd秒",second]; 33 | return title; 34 | }]; 35 | [sender countDownFinished:^NSString *(JKCountDownButton *countDownButton, NSUInteger second) { 36 | countDownButton.enabled = YES; 37 | return @"点击重新获取"; 38 | 39 | }]; 40 | 41 | }]; 42 | 43 | 44 | ###xib 45 | @property (weak, nonatomic) IBOutlet JKCountDownButton *countDownXib; 46 | 47 | - (IBAction)countDownXibTouched:(JKCountDownButton*)sender { 48 | sender.enabled = NO; 49 | //button type要 设置成custom 否则会闪动 50 | [sender startCountDownWithSecond:60]; 51 | 52 | [sender countDownChanging:^NSString *(JKCountDownButton *countDownButton,NSUInteger second) { 53 | NSString *title = [NSString stringWithFormat:@"剩余%zd秒",second]; 54 | return title; 55 | }]; 56 | [sender countDownFinished:^NSString *(JKCountDownButton *countDownButton, NSUInteger second) { 57 | countDownButton.enabled = YES; 58 | return @"点击重新获取"; 59 | 60 | }]; 61 | } 62 | ## License 63 | 64 | This code is distributed under the terms and conditions of the MIT license. 65 | 66 | ## Demo 67 | ![](https://raw.githubusercontent.com/shaojiankui/JKCountDownButton/master/demo.gif) 68 | -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaojiankui/JKCountDownButton/c8708aa3a639a5932e5c6de74b39bcfeafa9c422/demo.gif --------------------------------------------------------------------------------