I want to display current time in my iPhone app using my own custom graphics. What's the most efficient way to get the hours, minutes and seconds info? I thought about using NSDateFormatter to get each part but this seems to be too CPU intensive.
Asked
Active
Viewed 280 times
0
-
Care to explain how you came to that conclusion with NSDateFormatter? I could imagine that changing the format string several times a second could seriously slow it down, but what if you used one formatter per component? – Mike Abdullah Sep 25 '09 at 09:04
1 Answers
1
You'll want to use NSDateComponents. This answer on SO provides an example.
-
Also take a look at this answer on SO. It's a little more specific to your question http://stackoverflow.com/questions/743140/how-do-i-get-the-current-hour-using-cocoa – probablyCorey Sep 24 '09 at 23:06