├── Cartfile ├── Cartfile.resolved ├── .travis.yml ├── .DS_Store ├── LFCountDownButton.gif ├── LFCountDownButtonDemo ├── .DS_Store ├── LFCountDownButtonDemo │ ├── .DS_Store │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Icon-60@2x.png │ │ │ ├── Icon-60@3x.png │ │ │ ├── Icon-Small@2x.png │ │ │ ├── Icon-Small@3x.png │ │ │ ├── Icon-Small-40@2x.png │ │ │ ├── Icon-Small-40@3x.png │ │ │ └── Contents.json │ ├── Example │ │ ├── ViewController.h │ │ ├── AppDelegate.h │ │ ├── main.m │ │ ├── AppDelegate.m │ │ ├── ViewController.m │ │ └── ViewController.xib │ ├── LFCountDownButton │ │ ├── LFCountDownButton.h │ │ └── LFCountDownButton.m │ ├── Info.plist │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ └── zh-Hans.lproj │ │ └── LaunchScreen.storyboard └── LFCountDownButtonDemo.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ ├── xcshareddata │ └── xcschemes │ │ └── LFCountDownButtonDemo.xcscheme │ └── project.pbxproj ├── .tarvis.yml ├── countDownButton.podspec ├── LICENSE ├── .gitignore └── README.md /Cartfile: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Cartfile.resolved: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | os: osx 3 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VanSteven/countDownButton/HEAD/.DS_Store -------------------------------------------------------------------------------- /LFCountDownButton.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VanSteven/countDownButton/HEAD/LFCountDownButton.gif -------------------------------------------------------------------------------- /LFCountDownButtonDemo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VanSteven/countDownButton/HEAD/LFCountDownButtonDemo/.DS_Store -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VanSteven/countDownButton/HEAD/LFCountDownButtonDemo/LFCountDownButtonDemo/.DS_Store -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VanSteven/countDownButton/HEAD/LFCountDownButtonDemo/LFCountDownButtonDemo/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VanSteven/countDownButton/HEAD/LFCountDownButtonDemo/LFCountDownButtonDemo/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VanSteven/countDownButton/HEAD/LFCountDownButtonDemo/LFCountDownButtonDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VanSteven/countDownButton/HEAD/LFCountDownButtonDemo/LFCountDownButtonDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VanSteven/countDownButton/HEAD/LFCountDownButtonDemo/LFCountDownButtonDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@2x.png -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VanSteven/countDownButton/HEAD/LFCountDownButtonDemo/LFCountDownButtonDemo/Assets.xcassets/AppIcon.appiconset/Icon-Small-40@3x.png -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/Example/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LFCountDownButton 4 | // 5 | // Created by 兰柳锋 on 2017/2/7. 6 | // Copyright © 2017年 柳锋兰. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /.tarvis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | xcode_project: LFCountDownButtonDemo/LFCountDownButtonDemo.xcodeproj 3 | xcode_scheme: LFCountDownButtonDemo 4 | 5 | script: 6 | - xctool -project LFCountDownButtonDemo/LFCountDownButtonDemo.xcodeproj -scheme LFCountDownButtonDemo build test CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO 7 | 8 | after_success: 9 | - bash <(curl -s https://codecov.io/bash) -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/Example/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LFCountDownButton 4 | // 5 | // Created by 兰柳锋 on 2017/2/7. 6 | // Copyright © 2017年 柳锋兰. 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 | -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/Example/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LFCountDownButton 4 | // 5 | // Created by 兰柳锋 on 2017/2/7. 6 | // Copyright © 2017年 柳锋兰. 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 | -------------------------------------------------------------------------------- /countDownButton.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'countDownButton' 3 | s.version = '1.0.0' 4 | s.summary = 'An easy way to use countDown button,solving problem for into the background of the countdown' 5 | s.homepage = 'https://github.com/iOS-lancelot/countDownButton' 6 | s.license = 'MIT' 7 | s.authors = {'lanliufeng' => '445816317@qq.com'} 8 | s.platform = :ios, '7.0' 9 | s.source = {:git => 'https://github.com/iOS-lancelot/countDownButton.git', :tag => s.version} 10 | s.source_files = 'LFCountDownButtonDemo/LFCountDownButtonDemo/LFCountDownButton/**/*.{h,m}' 11 | s.requires_arc = true 12 | end 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 兰柳锋 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 | -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/Assets.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 | "size" : "29x29", 15 | "idiom" : "iphone", 16 | "filename" : "Icon-Small@2x.png", 17 | "scale" : "2x" 18 | }, 19 | { 20 | "size" : "29x29", 21 | "idiom" : "iphone", 22 | "filename" : "Icon-Small@3x.png", 23 | "scale" : "3x" 24 | }, 25 | { 26 | "size" : "40x40", 27 | "idiom" : "iphone", 28 | "filename" : "Icon-Small-40@2x.png", 29 | "scale" : "2x" 30 | }, 31 | { 32 | "size" : "40x40", 33 | "idiom" : "iphone", 34 | "filename" : "Icon-Small-40@3x.png", 35 | "scale" : "3x" 36 | }, 37 | { 38 | "size" : "60x60", 39 | "idiom" : "iphone", 40 | "filename" : "Icon-60@2x.png", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "size" : "60x60", 45 | "idiom" : "iphone", 46 | "filename" : "Icon-60@3x.png", 47 | "scale" : "3x" 48 | } 49 | ], 50 | "info" : { 51 | "version" : 1, 52 | "author" : "xcode" 53 | } 54 | } -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/LFCountDownButton/LFCountDownButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // LFCountDownButton.h 3 | // LFCountDownButton version 1.0.0 4 | // 5 | // Created by 兰柳锋 on 2017/2/7. 6 | // Copyright © 2017年 柳锋兰. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class LFCountDownButton; 12 | 13 | #pragma mark - BlockMethod 14 | 15 | /** 倒计时进行中 Countdown in progress */ 16 | typedef NSString* (^countDownButtonChanging)(LFCountDownButton *countDownButton,NSUInteger second); 17 | /** 倒计时结束 Countdown end */ 18 | typedef NSString* (^countDownButtonFinished)(LFCountDownButton *countDownButton,NSUInteger second); 19 | /** 点击倒计时按钮 Click the countdown button */ 20 | typedef void (^touchedCountDownButtonHandler)(LFCountDownButton *countDownButton,NSInteger tag); 21 | 22 | @interface LFCountDownButton : UIButton 23 | 24 | #pragma mark - ClassMethod 25 | 26 | /** 倒计时点击回调 Countdown click callback */ 27 | - (void)touchCountDownButtonHandler:(touchedCountDownButtonHandler)touchedCountDownButtonHandler; 28 | 29 | /** 倒计时进行中回调 Countdown running in progress callback */ 30 | - (void)countDownButtonChanging:(countDownButtonChanging)countDownButtonChanging; 31 | 32 | /** 倒计时结束回调 Countdown end callback */ 33 | - (void)countDownButtonFinished:(countDownButtonFinished)countDownButtonFinished; 34 | 35 | /** 开始倒计时 Start countdown */ 36 | - (void)startCountDownWithSecond:(NSUInteger)second; 37 | 38 | /** 停止倒计时 Stop countdown */ 39 | - (void)stopCountDown; 40 | 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ 61 | -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/zh-Hans.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/Example/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LFCountDownButton 4 | // 5 | // Created by 兰柳锋 on 2017/2/7. 6 | // Copyright © 2017年 柳锋兰. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | 20 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 21 | self.window.backgroundColor = [UIColor whiteColor]; 22 | self.window.rootViewController = [[UINavigationController alloc]initWithRootViewController:[[ViewController alloc]init]]; 23 | [self.window makeKeyAndVisible]; 24 | 25 | return YES; 26 | } 27 | 28 | 29 | - (void)applicationWillResignActive:(UIApplication *)application { 30 | // 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. 31 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 32 | } 33 | 34 | 35 | - (void)applicationDidEnterBackground:(UIApplication *)application { 36 | // 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. 37 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 38 | } 39 | 40 | 41 | - (void)applicationWillEnterForeground:(UIApplication *)application { 42 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 43 | } 44 | 45 | 46 | - (void)applicationDidBecomeActive:(UIApplication *)application { 47 | // 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. 48 | } 49 | 50 | 51 | - (void)applicationWillTerminate:(UIApplication *)application { 52 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 53 | } 54 | 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # countDownButton 2 | ![](https://travis-ci.org/iOS-lancelot/countDownButton.svg?branch=master) 3 | 4 | 5 | countDownButton,子类化UIButton实现iOS倒计时按钮,常常用于注册等发送验证码的时候进行倒计时操作 6 | 7 | countDownButton, subclassing UIButton implementation iOS countdown button, register with sending the verification code and countdown 8 | ## Demo 9 | ![Demo](LFCountDownButton.gif) 10 | 11 | ## Installation 12 | 13 | ### Installation with CocoaPods 14 | 15 | platform:ios,'7.0' 16 | target 'YourProjectName' do 17 | pod 'countDownButton' 18 | end 19 | 20 | 21 | ### Manually 22 | 23 | Copy countDownButton.h countDownButton.m in LFCountDownButton/ to your project. 24 | 25 | ## Usage 26 | ### Code 27 | 28 | @property(nonatomic,strong) LFCountDownButton *countDownButton; 29 | 30 | 31 | //创建倒计时按钮 32 | self.countDownButton = [[LFCountDownButton alloc]init]; 33 | self.countDownButton.frame = CGRectMake(10, 130, 150, 40); 34 | [self.countDownButton.titleLabel setFont:[UIFont systemFontOfSize:14.0f]]; 35 | [self.countDownButton setTitle:@"Start CountDown" forState:UIControlStateNormal]; 36 | [self.countDownButton setBackgroundColor:[UIColor redColor]]; 37 | [self.view addSubview:self.countDownButton]; 38 | 39 | // 1. 倒计时按钮点击 40 | [self.countDownButton touchCountDownButtonHandler:^(LFCountDownButton *countDownButton, NSInteger tag) { 41 | 42 | countDownButton.enabled = NO; 43 | 44 | //1.1开始倒计时 45 | [countDownButton startCountDownWithSecond:10]; 46 | 47 | //do something... 48 | 49 | //1.2 倒计时进行中 50 | [countDownButton countDownButtonChanging:^NSString *(LFCountDownButton *countDownButton, NSUInteger second) { 51 | 52 | NSString *title = [NSString stringWithFormat:@"%zd left",second]; 53 | return title; 54 | 55 | }]; 56 | 57 | //1.3 倒计时结束 58 | [countDownButton countDownButtonFinished:^NSString *(LFCountDownButton *countDownButton, NSUInteger second) { 59 | 60 | countDownButton.enabled = YES; 61 | return @"Obtain again"; 62 | 63 | }]; 64 | 65 | }]; 66 | 67 | 68 | ###xib 69 | @property (weak, nonatomic) IBOutlet LFCountDownButton *countDownButtonXib; 70 | 71 | *1.拖拽button控件到xib 72 | 2.修改button控件的的类,button type要设置成custom 否则会闪动 73 | 3.设置IBAction方法* 74 | 75 | - (IBAction)countDownButtonClickForXib:(id)sender { 76 | 77 | //要么拖拽方法的时候改变type(id改为LFCountDownButton类型),要么自己转下 78 | self.countDownButtonXib = (LFCountDownButton*)sender; 79 | self.countDownButtonXib.enabled = NO; 80 | 81 | //1.1开始倒计时 82 | [ self.countDownButtonXib startCountDownWithSecond:15]; 83 | 84 | //do something... 85 | 86 | //1.2 倒计时进行中 87 | [ self.countDownButtonXib countDownButtonChanging:^NSString *(LFCountDownButton *countDownButton, NSUInteger second) { 88 | 89 | NSString *title = [NSString stringWithFormat:@"%zd left",second]; 90 | return title; 91 | 92 | }]; 93 | 94 | //1.3 倒计时结束 95 | [ self.countDownButtonXib countDownButtonFinished:^NSString *(LFCountDownButton *countDownButton, NSUInteger second) { 96 | 97 | countDownButton.enabled = YES; 98 | return @"Obtain again"; 99 | }]; 100 | } 101 | 102 | ## License 103 | 104 | This code is distributed under the terms and conditions of the MIT license. 105 | 106 | 107 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo.xcodeproj/xcshareddata/xcschemes/LFCountDownButtonDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/Example/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LFCountDownButton 4 | // 5 | // Created by 兰柳锋 on 2017/2/7. 6 | // Copyright © 2017年 柳锋兰. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "LFCountDownButton.h" 11 | 12 | @interface ViewController () 13 | 14 | /**倒计时按钮*/ 15 | @property(nonatomic,strong) LFCountDownButton *countDownButton; 16 | @property (weak, nonatomic) IBOutlet LFCountDownButton *countDownButtonXib; 17 | 18 | @end 19 | 20 | @implementation ViewController 21 | 22 | - (void)viewDidLoad { 23 | 24 | [super viewDidLoad]; 25 | 26 | self.title = @"LFCountDownButtonDemo"; 27 | 28 | [self setupCountDownButtonPure]; 29 | 30 | } 31 | #pragma mark - 纯代码 32 | 33 | - (void)setupCountDownButtonPure{ 34 | 35 | //标题 36 | UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 70, 150, 40)]; 37 | titleLabel.text = @"Pure Code"; 38 | titleLabel.textColor = [UIColor whiteColor]; 39 | titleLabel.textAlignment = NSTextAlignmentCenter; 40 | titleLabel.font = [UIFont systemFontOfSize:14.0f]; 41 | titleLabel.backgroundColor = [UIColor redColor]; 42 | [self.view addSubview:titleLabel]; 43 | 44 | //创建倒计时按钮 45 | self.countDownButton = [[LFCountDownButton alloc]init]; 46 | self.countDownButton.frame = CGRectMake(10, 130, 150, 40); 47 | [self.countDownButton.titleLabel setFont:[UIFont systemFontOfSize:14.0f]]; 48 | [self.countDownButton setTitle:@"Start CountDown" forState:UIControlStateNormal]; 49 | [self.countDownButton setBackgroundColor:[UIColor redColor]]; 50 | [self.view addSubview:self.countDownButton]; 51 | 52 | // 1. 倒计时按钮点击 53 | [self.countDownButton touchCountDownButtonHandler:^(LFCountDownButton *countDownButton, NSInteger tag) { 54 | 55 | countDownButton.enabled = NO; 56 | 57 | //1.1开始倒计时 58 | [countDownButton startCountDownWithSecond:10]; 59 | 60 | //do something... 61 | 62 | //1.2 倒计时进行中 63 | [countDownButton countDownButtonChanging:^NSString *(LFCountDownButton *countDownButton, NSUInteger second) { 64 | 65 | NSString *title = [NSString stringWithFormat:@"%zd left",second]; 66 | return title; 67 | 68 | }]; 69 | 70 | //1.3 倒计时结束 71 | [countDownButton countDownButtonFinished:^NSString *(LFCountDownButton *countDownButton, NSUInteger second) { 72 | 73 | countDownButton.enabled = YES; 74 | return @"Obtain again"; 75 | 76 | }]; 77 | 78 | }]; 79 | 80 | } 81 | 82 | #pragma mark - Xib 83 | 84 | /** 85 | 1.拖拽button控件到xib 86 | 2.修改button控件的的类,button type要设置成custom 否则会闪动 87 | 3.设置IBAction方法 88 | 89 | */ 90 | - (IBAction)countDownButtonClickForXib:(id)sender { 91 | 92 | //要么拖拽方法的时候改变type(id改为LFCountDownButton类型),要么自己转下 93 | self.countDownButtonXib = (LFCountDownButton*)sender; 94 | self.countDownButtonXib.enabled = NO; 95 | 96 | //1.1开始倒计时 97 | [ self.countDownButtonXib startCountDownWithSecond:15]; 98 | 99 | //do something... 100 | 101 | //1.2 倒计时进行中 102 | [ self.countDownButtonXib countDownButtonChanging:^NSString *(LFCountDownButton *countDownButton, NSUInteger second) { 103 | 104 | NSString *title = [NSString stringWithFormat:@"%zd left",second]; 105 | return title; 106 | 107 | }]; 108 | 109 | //1.3 倒计时结束 110 | [ self.countDownButtonXib countDownButtonFinished:^NSString *(LFCountDownButton *countDownButton, NSUInteger second) { 111 | 112 | countDownButton.enabled = YES; 113 | return @"Obtain again"; 114 | }]; 115 | 116 | } 117 | 118 | #pragma mark - 停止倒计时 119 | 120 | - (IBAction)stopCountDown:(id)sender { 121 | 122 | [self.countDownButton stopCountDown]; 123 | 124 | [self.countDownButtonXib stopCountDown]; 125 | 126 | } 127 | 128 | 129 | - (void)didReceiveMemoryWarning { 130 | [super didReceiveMemoryWarning]; 131 | 132 | } 133 | 134 | 135 | @end 136 | -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/LFCountDownButton/LFCountDownButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // LFCountDownButton.m 3 | // LFCountDownButton version 1.0.0 4 | // 5 | // Created by 兰柳锋 on 2017/2/7. 6 | // Copyright © 2017年 柳锋兰. All rights reserved. 7 | // 8 | 9 | #import "LFCountDownButton.h" 10 | 11 | @interface LFCountDownButton () 12 | 13 | /** 倒计时秒数 Countdown seconds */ 14 | @property(nonatomic,assign) NSInteger second; 15 | /** 倒计时总时间 Total countdown time */ 16 | @property(nonatomic,assign) NSUInteger totalSecond; 17 | /** 定时器 timer */ 18 | @property(nonatomic,strong) NSTimer *timer; 19 | /** 时间 timer*/ 20 | @property(nonatomic,strong) NSDate *startDate; 21 | 22 | //Block 23 | 24 | @property(nonatomic,copy) countDownButtonChanging countDownButtonChanging; 25 | 26 | @property(nonatomic,copy) countDownButtonFinished countDownButtonFinished; 27 | 28 | @property(nonatomic,copy) touchedCountDownButtonHandler touchedCountDownButtonHandler; 29 | 30 | 31 | @end 32 | 33 | 34 | @implementation LFCountDownButton 35 | 36 | #pragma mark - Class方法 37 | 38 | /** 倒计时点击回调 Countdown click callback */ 39 | - (void)touchCountDownButtonHandler:(touchedCountDownButtonHandler)touchedCountDownButtonHandler{ 40 | 41 | _touchedCountDownButtonHandler = [touchedCountDownButtonHandler copy]; 42 | 43 | [self addTarget:self action:@selector(touchedBegin:) forControlEvents:UIControlEventTouchUpInside]; 44 | } 45 | /** 倒计时进行中 Countdown running in progress callback */ 46 | - (void)countDownButtonChanging:(countDownButtonChanging)countDownButtonChanging{ 47 | 48 | _countDownButtonChanging = [countDownButtonChanging copy]; 49 | 50 | } 51 | /** 倒计时结束 Countdown end callback */ 52 | - (void)countDownButtonFinished:(countDownButtonFinished)countDownButtonFinished{ 53 | 54 | _countDownButtonFinished = [countDownButtonFinished copy]; 55 | 56 | } 57 | 58 | /** 开始倒计时 Start countdown */ 59 | - (void)startCountDownWithSecond:(NSUInteger)second{ 60 | 61 | _second = second; 62 | _totalSecond = second; 63 | _timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timerStart:) userInfo:nil repeats:YES]; 64 | _startDate = [NSDate date]; 65 | [[NSRunLoop currentRunLoop]addTimer:_timer forMode:NSRunLoopCommonModes]; 66 | 67 | } 68 | /** 停止倒计时 Stop countdown */ 69 | - (void)stopCountDown{ 70 | 71 | if (_timer) { 72 | 73 | if ([_timer respondsToSelector:@selector(isValid)]) 74 | { 75 | if ([_timer isValid]) 76 | { 77 | [_timer invalidate]; 78 | _second = _totalSecond; 79 | 80 | if (_countDownButtonFinished) 81 | { 82 | [self setTitle:_countDownButtonFinished(self,_totalSecond)forState:UIControlStateNormal]; 83 | [self setTitle:_countDownButtonFinished(self,_totalSecond)forState:UIControlStateDisabled]; 84 | 85 | } 86 | else 87 | { 88 | [self setTitle:@"Obtain Again" forState:UIControlStateNormal]; 89 | [self setTitle:@"Obtain Again" forState:UIControlStateDisabled]; 90 | 91 | } 92 | } 93 | } 94 | } 95 | 96 | } 97 | 98 | #pragma mark - Selector方法 99 | /** 点击倒计时按钮 Click the countdown button */ 100 | - (void)touchedBegin:(LFCountDownButton*)sender{ 101 | 102 | if (_touchedCountDownButtonHandler) { 103 | 104 | _touchedCountDownButtonHandler(sender,sender.tag); 105 | } 106 | } 107 | /** 定时器 timer*/ 108 | - (void)timerStart:(NSTimer *)theTimer { 109 | 110 | double deltaTime = [[NSDate date] timeIntervalSinceDate:_startDate]; 111 | 112 | _second = _totalSecond - (NSInteger)(deltaTime+0.5) ; 113 | 114 | if (_second <= 0.0) 115 | { 116 | [self stopCountDown]; 117 | } 118 | else 119 | { 120 | if (_countDownButtonChanging) 121 | { 122 | [self setTitle:_countDownButtonChanging(self,_second) forState:UIControlStateNormal]; 123 | [self setTitle:_countDownButtonChanging(self,_second) forState:UIControlStateDisabled]; 124 | 125 | } 126 | else 127 | { 128 | NSString *title = [NSString stringWithFormat:@"%zd left",_second]; 129 | [self setTitle:title forState:UIControlStateNormal]; 130 | [self setTitle:title forState:UIControlStateDisabled]; 131 | 132 | } 133 | } 134 | 135 | } 136 | 137 | @end 138 | -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo/Example/ViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 32 | 43 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /LFCountDownButtonDemo/LFCountDownButtonDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | BE4C4D841E49B06000B41E06 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BE4C4D831E49B06000B41E06 /* Assets.xcassets */; }; 11 | BE4C4D871E49B06000B41E06 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BE4C4D851E49B06000B41E06 /* LaunchScreen.storyboard */; }; 12 | BE4C4D931E49B09D00B41E06 /* LFCountDownButton.m in Sources */ = {isa = PBXBuildFile; fileRef = BE4C4D911E49B09D00B41E06 /* LFCountDownButton.m */; }; 13 | BE4C4D9B1E49B0A200B41E06 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = BE4C4D961E49B0A200B41E06 /* AppDelegate.m */; }; 14 | BE4C4D9C1E49B0A200B41E06 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BE4C4D971E49B0A200B41E06 /* main.m */; }; 15 | BE4C4D9D1E49B0A200B41E06 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BE4C4D991E49B0A200B41E06 /* ViewController.m */; }; 16 | BE4C4D9E1E49B0A200B41E06 /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BE4C4D9A1E49B0A200B41E06 /* ViewController.xib */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | BE4C4D741E49B06000B41E06 /* LFCountDownButtonDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LFCountDownButtonDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | BE4C4D831E49B06000B41E06 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 22 | BE4C4D881E49B06000B41E06 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 23 | BE4C4D901E49B09D00B41E06 /* LFCountDownButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LFCountDownButton.h; sourceTree = ""; }; 24 | BE4C4D911E49B09D00B41E06 /* LFCountDownButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LFCountDownButton.m; sourceTree = ""; }; 25 | BE4C4D951E49B0A200B41E06 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 26 | BE4C4D961E49B0A200B41E06 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 27 | BE4C4D971E49B0A200B41E06 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 28 | BE4C4D981E49B0A200B41E06 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 29 | BE4C4D991E49B0A200B41E06 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 30 | BE4C4D9A1E49B0A200B41E06 /* ViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ViewController.xib; sourceTree = ""; }; 31 | BE4C4DAD1E49BB3800B41E06 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 32 | /* End PBXFileReference section */ 33 | 34 | /* Begin PBXFrameworksBuildPhase section */ 35 | BE4C4D711E49B06000B41E06 /* Frameworks */ = { 36 | isa = PBXFrameworksBuildPhase; 37 | buildActionMask = 2147483647; 38 | files = ( 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXFrameworksBuildPhase section */ 43 | 44 | /* Begin PBXGroup section */ 45 | BE4C4D6B1E49B06000B41E06 = { 46 | isa = PBXGroup; 47 | children = ( 48 | BE4C4D761E49B06000B41E06 /* LFCountDownButtonDemo */, 49 | BE4C4D751E49B06000B41E06 /* Products */, 50 | ); 51 | sourceTree = ""; 52 | }; 53 | BE4C4D751E49B06000B41E06 /* Products */ = { 54 | isa = PBXGroup; 55 | children = ( 56 | BE4C4D741E49B06000B41E06 /* LFCountDownButtonDemo.app */, 57 | ); 58 | name = Products; 59 | sourceTree = ""; 60 | }; 61 | BE4C4D761E49B06000B41E06 /* LFCountDownButtonDemo */ = { 62 | isa = PBXGroup; 63 | children = ( 64 | BE4C4D941E49B0A200B41E06 /* Example */, 65 | BE4C4D8E1E49B09D00B41E06 /* LFCountDownButton */, 66 | BE4C4D831E49B06000B41E06 /* Assets.xcassets */, 67 | BE4C4D851E49B06000B41E06 /* LaunchScreen.storyboard */, 68 | BE4C4D881E49B06000B41E06 /* Info.plist */, 69 | BE4C4D771E49B06000B41E06 /* Supporting Files */, 70 | ); 71 | path = LFCountDownButtonDemo; 72 | sourceTree = ""; 73 | }; 74 | BE4C4D771E49B06000B41E06 /* Supporting Files */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | ); 78 | name = "Supporting Files"; 79 | sourceTree = ""; 80 | }; 81 | BE4C4D8E1E49B09D00B41E06 /* LFCountDownButton */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | BE4C4D901E49B09D00B41E06 /* LFCountDownButton.h */, 85 | BE4C4D911E49B09D00B41E06 /* LFCountDownButton.m */, 86 | ); 87 | path = LFCountDownButton; 88 | sourceTree = ""; 89 | }; 90 | BE4C4D941E49B0A200B41E06 /* Example */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | BE4C4D971E49B0A200B41E06 /* main.m */, 94 | BE4C4D951E49B0A200B41E06 /* AppDelegate.h */, 95 | BE4C4D961E49B0A200B41E06 /* AppDelegate.m */, 96 | BE4C4D981E49B0A200B41E06 /* ViewController.h */, 97 | BE4C4D991E49B0A200B41E06 /* ViewController.m */, 98 | BE4C4D9A1E49B0A200B41E06 /* ViewController.xib */, 99 | ); 100 | path = Example; 101 | sourceTree = ""; 102 | }; 103 | /* End PBXGroup section */ 104 | 105 | /* Begin PBXNativeTarget section */ 106 | BE4C4D731E49B06000B41E06 /* LFCountDownButtonDemo */ = { 107 | isa = PBXNativeTarget; 108 | buildConfigurationList = BE4C4D8B1E49B06000B41E06 /* Build configuration list for PBXNativeTarget "LFCountDownButtonDemo" */; 109 | buildPhases = ( 110 | BE4C4D701E49B06000B41E06 /* Sources */, 111 | BE4C4D711E49B06000B41E06 /* Frameworks */, 112 | BE4C4D721E49B06000B41E06 /* Resources */, 113 | ); 114 | buildRules = ( 115 | ); 116 | dependencies = ( 117 | ); 118 | name = LFCountDownButtonDemo; 119 | productName = LFCountDownButtonDemo; 120 | productReference = BE4C4D741E49B06000B41E06 /* LFCountDownButtonDemo.app */; 121 | productType = "com.apple.product-type.application"; 122 | }; 123 | /* End PBXNativeTarget section */ 124 | 125 | /* Begin PBXProject section */ 126 | BE4C4D6C1E49B06000B41E06 /* Project object */ = { 127 | isa = PBXProject; 128 | attributes = { 129 | LastUpgradeCheck = 0810; 130 | ORGANIZATIONNAME = "柳锋兰"; 131 | TargetAttributes = { 132 | BE4C4D731E49B06000B41E06 = { 133 | CreatedOnToolsVersion = 8.1; 134 | DevelopmentTeam = HG2J8Z23E3; 135 | ProvisioningStyle = Manual; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = BE4C4D6F1E49B06000B41E06 /* Build configuration list for PBXProject "LFCountDownButtonDemo" */; 140 | compatibilityVersion = "Xcode 3.2"; 141 | developmentRegion = English; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = BE4C4D6B1E49B06000B41E06; 148 | productRefGroup = BE4C4D751E49B06000B41E06 /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | BE4C4D731E49B06000B41E06 /* LFCountDownButtonDemo */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | BE4C4D721E49B06000B41E06 /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | BE4C4D9E1E49B0A200B41E06 /* ViewController.xib in Resources */, 163 | BE4C4D871E49B06000B41E06 /* LaunchScreen.storyboard in Resources */, 164 | BE4C4D841E49B06000B41E06 /* Assets.xcassets in Resources */, 165 | ); 166 | runOnlyForDeploymentPostprocessing = 0; 167 | }; 168 | /* End PBXResourcesBuildPhase section */ 169 | 170 | /* Begin PBXSourcesBuildPhase section */ 171 | BE4C4D701E49B06000B41E06 /* Sources */ = { 172 | isa = PBXSourcesBuildPhase; 173 | buildActionMask = 2147483647; 174 | files = ( 175 | BE4C4D931E49B09D00B41E06 /* LFCountDownButton.m in Sources */, 176 | BE4C4D9C1E49B0A200B41E06 /* main.m in Sources */, 177 | BE4C4D9B1E49B0A200B41E06 /* AppDelegate.m in Sources */, 178 | BE4C4D9D1E49B0A200B41E06 /* ViewController.m in Sources */, 179 | ); 180 | runOnlyForDeploymentPostprocessing = 0; 181 | }; 182 | /* End PBXSourcesBuildPhase section */ 183 | 184 | /* Begin PBXVariantGroup section */ 185 | BE4C4D851E49B06000B41E06 /* LaunchScreen.storyboard */ = { 186 | isa = PBXVariantGroup; 187 | children = ( 188 | BE4C4DAD1E49BB3800B41E06 /* Base */, 189 | ); 190 | name = LaunchScreen.storyboard; 191 | sourceTree = ""; 192 | }; 193 | /* End PBXVariantGroup section */ 194 | 195 | /* Begin XCBuildConfiguration section */ 196 | BE4C4D891E49B06000B41E06 /* Debug */ = { 197 | isa = XCBuildConfiguration; 198 | buildSettings = { 199 | ALWAYS_SEARCH_USER_PATHS = NO; 200 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 201 | CLANG_ANALYZER_NONNULL = YES; 202 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 203 | CLANG_CXX_LIBRARY = "libc++"; 204 | CLANG_ENABLE_MODULES = YES; 205 | CLANG_ENABLE_OBJC_ARC = YES; 206 | CLANG_WARN_BOOL_CONVERSION = YES; 207 | CLANG_WARN_CONSTANT_CONVERSION = YES; 208 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 209 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 210 | CLANG_WARN_EMPTY_BODY = YES; 211 | CLANG_WARN_ENUM_CONVERSION = YES; 212 | CLANG_WARN_INFINITE_RECURSION = YES; 213 | CLANG_WARN_INT_CONVERSION = YES; 214 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 215 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 216 | CLANG_WARN_UNREACHABLE_CODE = YES; 217 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 218 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 219 | COPY_PHASE_STRIP = NO; 220 | DEBUG_INFORMATION_FORMAT = dwarf; 221 | ENABLE_STRICT_OBJC_MSGSEND = YES; 222 | ENABLE_TESTABILITY = YES; 223 | GCC_C_LANGUAGE_STANDARD = gnu99; 224 | GCC_DYNAMIC_NO_PIC = NO; 225 | GCC_NO_COMMON_BLOCKS = YES; 226 | GCC_OPTIMIZATION_LEVEL = 0; 227 | GCC_PREPROCESSOR_DEFINITIONS = ( 228 | "DEBUG=1", 229 | "$(inherited)", 230 | ); 231 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 232 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 233 | GCC_WARN_UNDECLARED_SELECTOR = YES; 234 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 235 | GCC_WARN_UNUSED_FUNCTION = YES; 236 | GCC_WARN_UNUSED_VARIABLE = YES; 237 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 238 | MTL_ENABLE_DEBUG_INFO = YES; 239 | ONLY_ACTIVE_ARCH = YES; 240 | SDKROOT = iphoneos; 241 | TARGETED_DEVICE_FAMILY = "1,2"; 242 | }; 243 | name = Debug; 244 | }; 245 | BE4C4D8A1E49B06000B41E06 /* Release */ = { 246 | isa = XCBuildConfiguration; 247 | buildSettings = { 248 | ALWAYS_SEARCH_USER_PATHS = NO; 249 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 250 | CLANG_ANALYZER_NONNULL = YES; 251 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 252 | CLANG_CXX_LIBRARY = "libc++"; 253 | CLANG_ENABLE_MODULES = YES; 254 | CLANG_ENABLE_OBJC_ARC = YES; 255 | CLANG_WARN_BOOL_CONVERSION = YES; 256 | CLANG_WARN_CONSTANT_CONVERSION = YES; 257 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 258 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 259 | CLANG_WARN_EMPTY_BODY = YES; 260 | CLANG_WARN_ENUM_CONVERSION = YES; 261 | CLANG_WARN_INFINITE_RECURSION = YES; 262 | CLANG_WARN_INT_CONVERSION = YES; 263 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 264 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 265 | CLANG_WARN_UNREACHABLE_CODE = YES; 266 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 267 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 268 | COPY_PHASE_STRIP = NO; 269 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 270 | ENABLE_NS_ASSERTIONS = NO; 271 | ENABLE_STRICT_OBJC_MSGSEND = YES; 272 | GCC_C_LANGUAGE_STANDARD = gnu99; 273 | GCC_NO_COMMON_BLOCKS = YES; 274 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 275 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 276 | GCC_WARN_UNDECLARED_SELECTOR = YES; 277 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 278 | GCC_WARN_UNUSED_FUNCTION = YES; 279 | GCC_WARN_UNUSED_VARIABLE = YES; 280 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 281 | MTL_ENABLE_DEBUG_INFO = NO; 282 | SDKROOT = iphoneos; 283 | TARGETED_DEVICE_FAMILY = "1,2"; 284 | VALIDATE_PRODUCT = YES; 285 | }; 286 | name = Release; 287 | }; 288 | BE4C4D8C1E49B06000B41E06 /* Debug */ = { 289 | isa = XCBuildConfiguration; 290 | buildSettings = { 291 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 292 | DEVELOPMENT_TEAM = HG2J8Z23E3; 293 | INFOPLIST_FILE = LFCountDownButtonDemo/Info.plist; 294 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 295 | PRODUCT_BUNDLE_IDENTIFIER = com.lanliufeng; 296 | PRODUCT_NAME = "$(TARGET_NAME)"; 297 | PROVISIONING_PROFILE = "df5fcd52-5143-4c8a-84ca-75ba432f1178"; 298 | PROVISIONING_PROFILE_SPECIFIER = com.lanliufeng; 299 | TARGETED_DEVICE_FAMILY = 1; 300 | }; 301 | name = Debug; 302 | }; 303 | BE4C4D8D1E49B06000B41E06 /* Release */ = { 304 | isa = XCBuildConfiguration; 305 | buildSettings = { 306 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 307 | DEVELOPMENT_TEAM = ""; 308 | INFOPLIST_FILE = LFCountDownButtonDemo/Info.plist; 309 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 310 | PRODUCT_BUNDLE_IDENTIFIER = com.lanliufeng; 311 | PRODUCT_NAME = "$(TARGET_NAME)"; 312 | TARGETED_DEVICE_FAMILY = 1; 313 | }; 314 | name = Release; 315 | }; 316 | /* End XCBuildConfiguration section */ 317 | 318 | /* Begin XCConfigurationList section */ 319 | BE4C4D6F1E49B06000B41E06 /* Build configuration list for PBXProject "LFCountDownButtonDemo" */ = { 320 | isa = XCConfigurationList; 321 | buildConfigurations = ( 322 | BE4C4D891E49B06000B41E06 /* Debug */, 323 | BE4C4D8A1E49B06000B41E06 /* Release */, 324 | ); 325 | defaultConfigurationIsVisible = 0; 326 | defaultConfigurationName = Release; 327 | }; 328 | BE4C4D8B1E49B06000B41E06 /* Build configuration list for PBXNativeTarget "LFCountDownButtonDemo" */ = { 329 | isa = XCConfigurationList; 330 | buildConfigurations = ( 331 | BE4C4D8C1E49B06000B41E06 /* Debug */, 332 | BE4C4D8D1E49B06000B41E06 /* Release */, 333 | ); 334 | defaultConfigurationIsVisible = 0; 335 | defaultConfigurationName = Release; 336 | }; 337 | /* End XCConfigurationList section */ 338 | }; 339 | rootObject = BE4C4D6C1E49B06000B41E06 /* Project object */; 340 | } 341 | --------------------------------------------------------------------------------