Today, I wanted to display a time-value of 9 minutes and 3 seconds like this: 09:03
Thus, I typed this snippet into my Objective-C code:
labelTimer.text = [NSString stringWithFormat:@"%2d:%2d", minutes, seconds ];
[/code]
This did not yield the result I wanted. The numbers were padded with spaces, not zeros. Sadly, Apple left out the options for the different format specifiers like f, d, @ … completely. You have to rely on old C skills… Continue reading
