将整数格式化为2个位置

Ste*_*hen 10 iphone integer

我试图将整数格式化为2个字符,即01,02,03而不是1,2,3,4.

我做了一些谷歌搜索但找不到任何东西.可以更改@"%d"以反映2个字符吗?

timeArray = [[NSMutableArray alloc] init];
 for (int i = 0; i < 25; i++){
  NSString *timeValue = [NSString stringWithFormat:@"%d", i];
  [timeArray addObject:timeValue];
  NSLog(@"Time: %@", timeValue);
 }
Run Code Online (Sandbox Code Playgroud)

问候,斯蒂芬

Ste*_*hen 14

得到它了 !!!!

@ "%02D"