suzuki-0000 / CountdownLabel

Simple countdown UILabel with morphing animation, and some useful function.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Restarting countdown

PedroAnibarro1 opened this issue · comments

Hi,

I'm trying to reset my countdown once it hit 0.

I have a call of function in the delegate countdownFinished() to set the countdown and start again.

The problem is that the label text is set up but it do not start.

Any idea?

Workaround

func countingAt(timeCounted timeCounted: NSTimeInterval, timeRemaining: NSTimeInterval){

        switch timeRemaining {
            case -1.0:
                updateCountdown()
            default:
                print("Time Remaining: \(timeRemaining)")
        }

    }

hi. timer has already invalidated when countdown finished.
use countingAt is the better workaround your wrote above.

commented

Maybe its just me but the delegate does not work for me.
none this code executes

func countingAt(timeCounted timeCounted: NSTimeInterval, timeRemaining: NSTimeInterval) {
        switch timeRemaining {
        case 10:
            print("10 seconds remaining")
        case -1.0:
            print("timer invalidated")
        default:
            print("Time Remaining: \(timeRemaining)")
        }
    }

@PedroAnibarro1 Thanks for the solution mine works with case 1: instead for -1