0

Obc Cを使用してXcodeでカウントダウンタイマーを作成しています。これについては初心者で、タイマーの支援が必要です。入力した時間からカウントダウンします。

現在、私のコードは次のようになっています。

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


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

このカウントダウンは、99 分以内からカウントダウンしている限り、完全に機能します。もう 1 つの int を何時間も使用したいのですが、そうすると何か問題が発生し、エラーが発生します。

このカウンターに「時間」の整数をもう 1 つ追加する方法を説明してください。

私は次のことを試しましたが、うまくいきません:

-(void) timerRun {
    secoundCount = secondCount - 1;
    int hours = secondCount / 60;
    int minuts = secondCount / 60;
    int seconds = secondCount - (minuts * 60);


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

前もって感謝します

4

2 に答える 2