I am making on application in which user have to select the time, example 5 min or 10 min or 15 min and after that the timer will run arround 15 seconds and will called another function.Timer should have to run after every 15 seconds, i have implemented the above the things and it is working, The only thing which i am not getting is that how to run NSTimer for 5 mins or 10 mins with 15 seconds timeframe, Like timer should run time interval for arround 15 seconds and after 5 minutes it should stop.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- Could I create “Call” button in HTML 5 IPhone appl
- Unable to process app at this time due to a genera
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Open iOS 11 Files app via URL Scheme or some other
- Can keyboard of type UIKeyboardTypeNamePhonePad be
- Can not export audiofiles via “open in:” from Voic
- XCode 4.5 giving me “SenTestingKit/SenTestKit.h” f
You can use 2 different
NSTimers
, one that fires every 15 secs, the second one that fires after 5 min and stops the first one. Could this work for you?you have to check nsdate one as global in appdelegate(static) or anywhere and one within function of timer which you call ..then set time interval for 15 seconds and check whether current minute has difference of 5 minutes from global timer if it matched then stop timer
You fire timer every 15 seconds and in the timer fire method, keep adding the time and when time reaches 10 mins (or 15 mins), stop the timer.