Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

DIGITALiam

macrumors newbie
Original poster
Jun 23, 2010
25
0
Hey I'm making a timer app that has both minutes and seconds. To do this I am using two different labels. How can I make sure it is always two digits (10:01 not 10:1).

Thanks in advance.
 

DIGITALiam

macrumors newbie
Original poster
Jun 23, 2010
25
0
If the number is less than 10 put a 0 in front of it. Just always convert the int to NSString and put it in the label that way.

I thought of that too but it seems like there would be a more official way of doing it.
 

SilentPanda

Moderator emeritus
Oct 8, 2002
9,992
31
The Bamboo Forest
The only other reasonable way I can think of doing it would be to use a formatter. But admittedly I'm still working my way through the API so that might not be viable.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.