-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;
    }
}

XcodeはNSString、データ引数がフォーマット文字列で使用されていないことを行で伝えており、タイマーを実行しようとするたびに表示されるのは、2d:.2d Objective Cをよく知っている人は私のコードを見てください.

4

1 に答える 1

2

パーセント記号がありません、相棒。

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

.2d交換仕様ではありません。

于 2013-04-19T22:56:01.917 に答える