It will keep counting down and updating the current time. Anyone has any idea how to approach this problem? I don’t see how the NStimer will recognize the date format like this:
20110803 23:59:59
It will keep counting down and updating the current time. Anyone has any idea
Share
Look up
NSDateFormatter. You can specify a format string (-[setDateFormat:])that lets you convert to AND fromNSDateandNSString.When converting back to your countdown view, you may want to use
NSDateComponentsandNSCalendarto get the pieces you need for your countdown label (instead ofNSDateFormatter). You could do something like:This will calculate all the unit differences for you (with respect to the device’s currently configured calendar settings).
You can get the components back with a call like
[countdown day]or[countdown hour].