Having some trouble with the delegate call
ethanwa opened this issue · 3 comments
ethanwa commented
I have the following code in a standard UIViewController class. I'm setting the APNumberPadDelegate to the class, and setting the delegate on the numberPad to self.
The keyboard appears fine and has the "X" on it as expected. But for some reason though the private func numberPad()
delegate function isn't getting called. Any ideas why?
class WishListViewController: APNumberPadDelegate
`
let okAction = UIAlertAction(title: "Test", style: .default, handler: {(alert: UIAlertAction!) -> Void in
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: {(alert: UIAlertAction!) -> Void in
print("Cancel Pressed")
})
barcodeAlertView.addTextField(configurationHandler: {textField -> Void in
let numberPad = APNumberPad(delegate: self)
numberPad.leftFunctionButton.setTitle("X", for: .normal)
textField.inputView = numberPad
textField.textAlignment = .center
textField.clearButtonMode = .whileEditing
})
barcodeAlertView.addAction(cancelAction)
self.present(barcodeAlertView, animated: true, completion: nil)
}
`
private func numberPad(_ numberPad: APNumberPad, functionButtonAction functionButton: UIButton, textInput: UIResponder & UITextInput) {
textInput.insertText("X")
}
`
ramoliveira commented
@ethanwa, did you find out why was not being called? I’ve been going through the same problem here.
nagurbee commented
same problem here also can you please help me