Delegate is nil.
cukingpro opened this issue · 2 comments
cukingpro commented
`class DecimalNumberPad: APNumberPad {
convenience init() {
self.init(delegate: DecimalNumberPadDelegate())
leftFunctionButton.setTitle(".", for: .normal)
}
}`
`class DecimalNumberPadDelegate: NSObject, APNumberPadDelegate {
func numberPad(_ numberPad: APNumberPad, functionButtonAction functionButton: UIButton, textInput: UIResponder & UITextInput) {
textInput.insertText(".")
}
}`
When I create delegate class, the delegate is nil when I click on left button.
It doesn't happen when I set delegate is viewcontroller
podkovyrin commented
It happens because delegate
is stored as weak:
https://github.com/podkovyrin/APNumberPad/blob/master/APNumberPad/Classes/APNumberPad.m#L36
You need to keep a strong reference to your DecimalNumberPadDelegate
somewhere.
nagurbee commented
for me also it is not working can some one please help me