suzuki-0000 / CountdownLabel

Simple countdown UILabel with morphing animation, and some useful function.
MIT License
995 stars 190 forks source link

Restarting countdown #8

Open PedroAnibarro1 opened 8 years ago

PedroAnibarro1 commented 8 years ago

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?

PedroAnibarro1 commented 8 years ago

Workaround

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

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

    }
suzuki-0000 commented 8 years ago

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

otymartin commented 7 years ago

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)")
        }
    }
Umair-ios commented 5 years ago

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