Hi everyone
Im trying to make a time which will start and stop when i move a slider. So far i've managed to get the timer to start when i touch down on the slider but can't seem to find a way to have the timer stop once the slider gets to the max value or when i leave go of it. Any suggestions?
below is the code i've got so far.
thanks
Im trying to make a time which will start and stop when i move a slider. So far i've managed to get the timer to start when i touch down on the slider but can't seem to find a way to have the timer stop once the slider gets to the max value or when i leave go of it. Any suggestions?
below is the code i've got so far.
thanks
Code:
- (IBAction)start{
myTicker = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(showActivity) userInfo:nil repeats:YES];
}
- (IBAction)reset{
time.text = @"0";
}
- (void)showActivity {
int currentTime = [time.text intValue];
int newTime = currentTime + 1;
time.text = [NSString stringWithFormat:@"%d", newTime];
if (myslider.value == 100)
{
[myTicker invalidate];
}