Reset timer when button touches are cancelled

This commit is contained in:
Brent Whitman 2017-03-24 13:26:50 -07:00
parent ae068ac0fd
commit fae1225e36
1 changed files with 3 additions and 0 deletions

View File

@ -177,6 +177,7 @@ import UIKit
button.addTarget(self, action: #selector(GMStepper.leftButtonTouchDown), for: .touchDown)
button.addTarget(self, action: #selector(GMStepper.buttonTouchUp), for: .touchUpInside)
button.addTarget(self, action: #selector(GMStepper.buttonTouchUp), for: .touchUpOutside)
button.addTarget(self, action: #selector(GMStepper.buttonTouchUp), for: .touchCancel)
return button
}()
@ -189,6 +190,7 @@ import UIKit
button.addTarget(self, action: #selector(GMStepper.rightButtonTouchDown), for: .touchDown)
button.addTarget(self, action: #selector(GMStepper.buttonTouchUp), for: .touchUpInside)
button.addTarget(self, action: #selector(GMStepper.buttonTouchUp), for: .touchUpOutside)
button.addTarget(self, action: #selector(GMStepper.buttonTouchUp), for: .touchCancel)
return button
}()
@ -298,6 +300,7 @@ import UIKit
backgroundColor = buttonsBackgroundColor
layer.cornerRadius = cornerRadius
clipsToBounds = true
labelOriginalCenter = label.center
NotificationCenter.default.addObserver(self, selector: #selector(GMStepper.reset), name: NSNotification.Name.UIApplicationWillResignActive, object: nil)
}