-1
-(void) timerRun{
    secondsCount = secondsCount - 1;
    int minuts = secondsCount /60;
    int seconds = secondsCount - (minuts * 60);

    NSString *timerOutput = [NSString stringWithFormat: @"%2d:.2d" , minuts, seconds];
    countdownLabel.text = timerOutput;

    if (secondsCount == 0) {
        [countdownTimer invalidate];
        countdownLabel = nil;
    }
}

XcodeNSString在行中告诉我格式字符串未使用数据参数,并且每次我尝试运行计时器时,都会出现:是否2d:.2d 有了解 Objective C 的人请查看我的代码。

4

1 回答 1

2

你少了一个百分号,伙计。

NSString *timerOutput = [NSString stringWithFormat: @"%2d:.2d" , minuts, seconds];

.2d不是替代规格。

于 2013-04-19T22:56:01.917 回答