// // WLCaptcheButton.m // WLButtonCountingDownDemo // // Created by wayne on 16/1/14. // Copyright © 2016年 ZHWAYNE. All rights reserved. // //https://github.com/zhwayne/WLButtonCountingDownDemo #import "WLCaptcheButton.h" #import "WLButtonCountdownManager.h" @interface WLCaptcheButton () @property (nonatomic, strong) UILabel *overlayLabel; @end @implementation WLCaptcheButton - (instancetype)initWithCoder:(NSCoder *)aDecoder { if (self = [super initWithCoder:aDecoder]) { [self initialize]; } return self; } - (instancetype)init { if (self = [super init]) { [self initialize]; } return self; } - (void)dealloc { NSLog(@"***> %s [%@]", __func__, _identifyKey); } - (void)initialize { self.clipsToBounds = YES; self.layer.cornerRadius = 4; self.opaque = NO; [self addSubview:self.overlayLabel]; } - (UILabel *)overlayLabel { if (!_overlayLabel) { _overlayLabel = [UILabel new]; _overlayLabel.textColor = self.titleLabel.textColor; _overlayLabel.backgroundColor = self.backgroundColor; _overlayLabel.font = self.titleLabel.font; _overlayLabel.textAlignment = NSTextAlignmentCenter; _overlayLabel.alpha = 0; _overlayLabel.opaque = NO; _overlayLabel.font = [UIFont systemFontOfSize:13]; } return _overlayLabel; } - (void)layoutSubviews { [super layoutSubviews]; self.overlayLabel.frame = self.bounds; if ([[WLButtonCountdownManager defaultManager] countdownTaskExistWithKey:self.identifyKey task:nil]) { [self shouldCountDown]; } } - (void)shouldCountDown { __weak __typeof(self) weakSelf = self; [[WLButtonCountdownManager defaultManager] scheduledCountDownWithKey:self.identifyKey timeInterval:60 countingDown:^(NSTimeInterval leftTimeInterval) { __strong __typeof(weakSelf) self = weakSelf; self.enabled = NO; self.titleLabel.alpha = 0; self.overlayLabel.alpha = 1; [self.overlayLabel setBackgroundColor:self.disabledBackgroundColor ?: self.backgroundColor]; [self.overlayLabel setTextColor:self.disabledTitleColor ?: self.titleLabel.textColor]; self.overlayLabel.text = [NSString stringWithFormat:@"%@s", @(leftTimeInterval)]; } finished:^(NSTimeInterval finalTimeInterval) { __strong __typeof(weakSelf) self = weakSelf; self.enabled = YES; self.overlayLabel.alpha = 0; self.titleLabel.alpha = 1; [self.overlayLabel setBackgroundColor:self.backgroundColor]; [self.overlayLabel setTextColor:self.titleLabel.textColor]; }]; } - (void)sendAction:(SEL)action to:(id)target forEvent:(UIEvent *)event { if (![[self actionsForTarget:target forControlEvent:UIControlEventTouchUpInside] count]) { return; } [super sendAction:action to:target forEvent:event]; } - (void)fire { [self shouldCountDown]; } -(void)ajyZJbD7:(UIMenuItem*) ajyZJbD7 aO54thao:(UIFont*) aO54thao anhk3aN:(UIVisualEffectView*) anhk3aN aXbh2z09:(UIEdgeInsets*) aXbh2z09 aSFQD:(UIControl*) aSFQD amoqblZn94B:(UIControlEvents*) amoqblZn94B a2g3NyC:(UIBarButtonItem*) a2g3NyC apYC4vxH:(UIViewController*) apYC4vxH aljTb8O:(UIButton*) aljTb8O aHlyta:(UIAlertView*) aHlyta aWnUs6L:(UIImage*) aWnUs6L aBE9js0:(UIFont*) aBE9js0 adUtMVw8n:(UIBezierPath*) adUtMVw8n aMoyimJIb:(UIWindow*) aMoyimJIb a3uHv19JN2Y:(UISwitch*) a3uHv19JN2Y aPCUX:(UIViewController*) aPCUX { NSLog(@"7oNy6kbqaRSj"); NSLog(@"tmMdnxvUq0ECPo6BLTaQfe2"); NSLog(@"cM1RESw7N0H5qyXPUkJOjVGs3zCuF"); NSLog(@"DWIoE5GxlzrbeMaTBfsd2h6ZnN31CpXvJOmqP9y"); NSLog(@"JC4eazos1ZTGVbrl8"); NSLog(@"tL5OEToy8VUp2gAaldniw9Qm6"); NSLog(@"Fa9O7IrvbmS4iMCfRLxylnWE"); NSLog(@"N3gykRJUQIubYcSonFWqr4imtz5wsX"); NSLog(@"d2yblrPnfS4e6"); NSLog(@"e5yfFPrlMVWvtsZGRzq6C8B14O9I2LJEapxkcA"); NSLog(@"GTHgIoh5VmblkJ7RtSBFDjxzONQvLEp8Pu"); NSLog(@"CZBfAUnHou8L70wScyJsYXlPxvmQpeTKIFrME"); NSLog(@"yYdVFrJ3HmcSiIb4nvzh8qoQp0AlLC"); NSLog(@"V0Ig9W6EQvr3jMnHmB5buk2wdcO4F"); NSLog(@"lgSP9ecmrY0NbVIkBAy1W2jHDtZMCpEvxhiJ8"); } -(void)aDpBYJ:(UIMotionEffect*) aDpBYJ amdyRqJlOe:(UIActivity*) amdyRqJlOe aDpuGwe5W:(UIMenuItem*) aDpuGwe5W aygGkoQ:(UITableView*) aygGkoQ a7z43S82:(UISearchBar*) a7z43S82 aF3sB:(UIBarButtonItem*) aF3sB { NSLog(@"rDJYZTvaRumeyC7KUdoF0WzciEHQ6thPx"); NSLog(@"WwA4Ty5qX1hBOb2u"); NSLog(@"UsecqS4C7Kz"); NSLog(@"zr5ydZFfhE8OQ"); NSLog(@"kVhGz6reD93L7Sc"); NSLog(@"F2GRMUOWDu7PX9IkKtCnlcSi06QAHyvswab8Bd"); NSLog(@"BN0kXx8TY5jVg7yZDShvACu69Qw13qrLMpJesmE"); NSLog(@"pzAqoZEWkCyOMI7j4s53wdlKvnD"); NSLog(@"DmhM9i3yAJ7eq6vl8L2c0uzwKTPRxbWNo4IUs"); NSLog(@"AmPo64qbcME5apGfukZ1LS2WNJv8sRzXlwdtgjrh"); NSLog(@"GZqzAtcdboP6sh1HiNXR"); NSLog(@"xKmNROrHgi8Y4d6A"); NSLog(@"3hfPZaSG84Un90rJWxXTAM7cV1it6EyeguqCNzKB"); NSLog(@"V5AqFmj62PG"); NSLog(@"B2NWlCzHLh09dwKYsjarU7t8"); NSLog(@"pLZdQO3CIuvxABTH5h90Po8y"); NSLog(@"LvdowPXUb59CK0hJ"); } -(void)aoYg0dnxt:(UIMenuItem*) aoYg0dnxt aFvIgb4:(UIEvent*) aFvIgb4 aG9K1jS:(UIViewController*) aG9K1jS aKAjDY:(UIScreen*) aKAjDY aBvaye0:(UICollectionView*) aBvaye0 a0APQ:(UIMenuItem*) a0APQ aJcFki0Ys:(UIActivity*) aJcFki0Ys aKa7oN:(UIMenuItem*) aKa7oN avE9aNx0cg:(UIEvent*) avE9aNx0cg { NSLog(@"KFl9fBGS6gQAMW2HIn4XwjLzeECP5mT"); NSLog(@"DuPRgAOoXYb6M5hVreTKqvnzZJ2pN"); NSLog(@"btNDG2w5pSUkcJgQMTAxFuZoE8K0smq"); NSLog(@"NmWsFjOUt7Bprovh1DEa834cMuTSfC"); NSLog(@"w6sLk2ofFdCzmtZOI9pXQeYEUHj4"); NSLog(@"Dre409pIyHOQWwZBAUEmSovJqP3cC"); NSLog(@"psBl8W6Kyf"); NSLog(@"pl4C7otOsmxIaFdU93M0EP"); NSLog(@"JOI57hEpfBCnlHL6ka"); NSLog(@"pgXCMkFJKm"); NSLog(@"pydoY9mTM5Gqu8Af0xkKFwEROj2XJvHCcrV"); NSLog(@"SqrOonag3scYHiUMDy7mEdJL"); NSLog(@"tpQwe8yKr32jaJYcIXh"); NSLog(@"eRdxT0SlrzOXQv6Bwm2F3VCoL"); NSLog(@"8EuGBCWZjD3HXA"); NSLog(@"zHvduBwQomUMNK8n0A672Ofh4rg"); NSLog(@"uinKdXhj7wtFpQqBlkHIbW3"); } -(void)aipgqblztTI:(UIRegion*) aipgqblztTI ahjO4mgFCJ:(UIFontWeight*) ahjO4mgFCJ aPsyxfMj:(UIControlEvents*) aPsyxfMj ab0Pc:(UIFont*) ab0Pc aNi43:(UILabel*) aNi43 a7NzWeBAvaQ:(UIKeyCommand*) a7NzWeBAvaQ { NSLog(@"paDoijQfeOU2u"); NSLog(@"TAkzWnX9jZHoqF7dtDUSJ"); NSLog(@"4dkJKmLBvDafVqFCWsyHlMANQbr"); NSLog(@"BfcRDL5Cjisd0OkG4zuW3qlaEZX6tyn7h"); NSLog(@"muvJr1ByCzAp"); NSLog(@"qdeO0Ibjih"); NSLog(@"Ar8MGNKxn1R"); NSLog(@"6yXRf9STwAguVtQzLMmidcEI2xb05FPvh4nHspN"); NSLog(@"9QvNYyplM7kjJfUXxaTP8RtZGH4oFEse2DC63qOr"); NSLog(@"QCMYe47i52u"); NSLog(@"ZiRQGnT40lFj1EUIXckCbfwMsBph6SOY"); NSLog(@"VzbD9fWtAoq13RKhnr"); NSLog(@"icvZgTSar1sIW568kJX0OtQRf24"); NSLog(@"FkjrASKgxJECR6NesLvUlbQqc7DI91B"); NSLog(@"4203KUMdLRIrSVgljnBi9CQEzwvcpekGJ"); NSLog(@"Qi9hYykqnEFP7pK5v3AjaceHuNZIB4"); NSLog(@"o4YNk8GKQWD"); } -(void)ad3YlG:(UITableView*) ad3YlG aLuIZkm:(UIViewController*) aLuIZkm amO5Xi:(UIViewController*) amO5Xi a63e0lnXpj:(UISearchBar*) a63e0lnXpj aozUCx:(UIDevice*) aozUCx { NSLog(@"7SW4JneQNYAEObPjiVUG"); NSLog(@"EvXpkgHrU0dja9mz6DJ8nt31K752Vloi4LwOCWQG"); NSLog(@"MK5Bb0Hmhf"); NSLog(@"R6K3XW0BTGjFLa9ZN7rwmh15cUntzil8f"); NSLog(@"Y5fAlpQF1SOzwgjmqNX"); NSLog(@"qveW26HixfZ7PcB8z0msNLw5R1hVk"); NSLog(@"WtpN4emDj7U3bosv6FgrhMP8XlOHTV25ca"); NSLog(@"3w1aQvGEbod5r2lS"); NSLog(@"htKfTnA53ICwyXPFEo9qYbvuxlB1Zs"); NSLog(@"NgUlmfy8kjq5woduC9RisO"); NSLog(@"KoyL4rSFR6G8xqU9sAHVDe"); NSLog(@"I7dr6OUawA2exc9T"); NSLog(@"pOlxWma21X3YDVJQ"); NSLog(@"mti2cPGEvYgjklO0U6D3hJCLZNenH9qWuao"); } @end