I have an NSTtimer implemented and it's working fine. I also have the time interval argument connected to a UISlider for the iPhone. However when I change it's value the NSTimer is still running at the original time interval it does not get updated. How can I implement an NSTimer and have it change it's time interval as the value of my UISlider changes. Below is the line I am using for the NSTimer.
[NSTimer scheduledTimerWithTimeInterval:mySlider.value
target:self
selector:@selector(myMethod)
userInfo:nil
repeats:YES];
I want it to constantly update it time interval with the value of the UISlider.
You can't I'm afraid. Invalidate it with:
[myTimer invalidate];
Then create a new one with the new time. You may have to set it to nil first as well.
myTimer = nil;
myTimer = [NSTimer scheduledTimerWithTimeInterval:mySlider.value
target:self
selector:@selector(myMethod)
userInfo:nil
repeats:YES];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With