This commit is contained in:
lianxiang
2018-10-19 20:23:26 +08:00
parent e06dc32099
commit d845ed2cb0
12 changed files with 255 additions and 49 deletions
@@ -9,6 +9,8 @@
#import "MaskTimeCircularProgressView.h"
#import "LXCountTimer.h"
#import "SHineLabel.h"
#import "GIGaDateHelper.h"
#import "AppDelegate.h"
@interface MaskTimeCircularProgressView()
@property (nonatomic) CADisplayLink *displayLink;
@@ -20,7 +22,6 @@
@property (nonatomic,strong) NSTimer *playTimer;
@property (nonatomic,strong) UIImageView *holderImageView;
@end
@implementation MaskTimeCircularProgressView
@@ -145,8 +146,8 @@
slice.lineCap = kCALineJoinRound;
slice.lineJoin = kCALineJoinBevel;
slice.path = smoothedPath.CGPath;
return slice;
}
- (void)setProgress:(float)progress{
@@ -180,7 +181,10 @@
- (void)startWith:(NSTimeInterval)time{
self.timeinterval = time;
[self countDown:time];
//进度圆环
[self start];
}
@@ -200,13 +204,37 @@
-(void)countDown:(NSTimeInterval)timeInterVal{
NSString *timeformat = [GiGaHelper stringWithNSTimerinterval:timeInterVal];
NSArray *timesArr = [timeformat componentsSeparatedByString:@":"];
NSString *hour = timesArr[0];
NSString *min = timesArr[1];
NSString *sec = timesArr[2];
[self countTimeBegain:hour.integerValue minute:min.integerValue second:sec.integerValue];
AppDelegate *delegate =(AppDelegate *) [[UIApplication sharedApplication] delegate];
if (delegate.isMasking) {
}else{
[GIGaDateHelper saveSatrtDate];
}
NSDate *startDate = [GIGaDateHelper getStartDate];
NSDate* dat = [NSDate dateWithTimeIntervalSinceNow:0];
if (startDate == nil) {
startDate = dat;
}
NSTimeInterval passt = [GIGaDateHelper getTimebySubtracting:startDate andDate2:dat];
NSLog(@"passT %0.f",passt);
NSTimeInterval cunrenShowTimCount = timeInterVal > passt ? timeInterVal - passt: timeInterVal;
delegate.isMasking= YES;
weakify(self);
[self.timer countDownWithtimerInterval:cunrenShowTimCount completeBlock:^(NSInteger day, NSInteger hour, NSInteger minute, NSInteger second) {
[weakSelf refreshTimeCount:hour minute:minute second:second];
if (minute==0 && second == 0) {
delegate.isMasking = NO;
[GIGaDateHelper removeStartDate];
[GIGaDateHelper saveisMaskingflag:NO];
}
}];
}
#pragma mark 开始计时
@@ -218,8 +246,11 @@
[self.timer countDownWithStratTimeStamp:nowTimestamp finishTimeStamp:futrueTimestamp completeBlock:^(NSInteger day, NSInteger hour, NSInteger minute, NSInteger second) {
[weakSelf refreshTimeCount:hour minute:minute second:second];
}];
}
-(void)refreshTimeCount:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second{
self.countLabel.text = [NSString stringWithFormat:@"%02ld:%02ld",minute,second];