10 から 0 までのカウントダウン タイマーを作成します。カウンターを秒単位で表示する uilabel を作成します。今度は、00:00 のように、ラベルにカウンターの分と秒を表示させたいと思います。どうやってやるの?ここに私のカウントダウンコードがあります:
-(void)countdown
{
countdownCounter -= 1;
countdown.text = [NSString stringWithFormat:@"%i", countdownCounter];
}
-(IBAction)strat:(id)sender
{
countdownCounter = 10;
countdownTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(countdown) userInfo:nil repeats:YES];
}
}
ありがとう!