pkluz / PKHUD

A Swift based reimplementation of the Apple HUD (Volume, Ringer, Rotation,…) for iOS 8.
MIT License
3.79k stars 494 forks source link

Add hideTimer to RunLoop's common modes. #217

Open arror opened 6 years ago

arror commented 6 years ago
open func hide(afterDelay delay: TimeInterval, completion: TimerAction? = nil) {
        let key = UUID().uuidString
        let userInfo = ["timerActionKey": key]
        if let completion = completion {
            timerActions[key] = completion
        }

        hideTimer?.invalidate()
        hideTimer = Timer.scheduledTimer(timeInterval: delay,
                                                           target: self,
                                                           selector: #selector(PKHUD.performDelayedHide(_:)),
                                                           userInfo: userInfo,
                                                           repeats: false)
    }
PGLongo commented 6 years ago

Can you add an explanation?

buyu03 commented 4 years ago

Can you add an explanation?

hideTimer is in Default Mode of runloop, it should be added to Common Mode, otherwise, when scrollView slide, timer will stop