Skip to content

Instantly share code, notes, and snippets.

@fsegouin
Created September 18, 2014 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fsegouin/7fe7f7781600ba5a415c to your computer and use it in GitHub Desktop.
Save fsegouin/7fe7f7781600ba5a415c to your computer and use it in GitHub Desktop.
Timer with DDHTimerControl
_timerControl = [DDHTimerControl timerControlWithType:DDHTimerTypeSolid];
_timerControl.translatesAutoresizingMaskIntoConstraints = NO;
_timerControl.color = [UIColor colorWithHexString:@"444444" alpha:0.2];
_timerControl.ringWidth = 3;
_timerControl.minutesOrSeconds = 60;
_timerControl.userInteractionEnabled = NO;
UIView *topView = (UIView *)[self.tableView viewWithTag:10];
_timerControl.frame = CGRectMake(0, 0, 66, 66);
_timerControl.center = CGPointMake(topView.frame.size.width/2, (topView.frame.size.height-20)/2);
[_timerControl addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged];
[topView addSubview:_timerControl];
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(changeTimer:) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
_endDate = [NSDate dateWithTimeIntervalSinceNow:12.0f*60.0f];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment