How to set the delegate?
ntkon opened this issue · 4 comments
Hi @luximetr
I like this library and really want to use it, but I really need to get access to some delegate methods for when the text changes, didBegin/didEnd editing, shouldReturn etc.
How do I attach a delegate. When I try to do:
mField.textInputFieldDelegates = self
I get the error message:
Cannot assign to property: 'textInputFieldDelegates' setter is inaccessible
Can you advise me?
(PS Using AnyFormatKit (0.1.2))
Thanks @luximetr , but there is one other catch?
The delegate does not tell me when the textFieldDidBeginEditing
?
I need this so I can keep track of which field is being edited so that I can scroll my UIScrollView container so the user can see the field they are editing.
Any suggestions?
Sorry about the span @luximetr . I found that TextInputFieldDelegate solved my problem above.
Another question I have is: I want to add a hook for when the text field has changed:
.addTarget(self, action: #selector(textFieldDidChange(_:)), for: UIControlEvents.editingChanged)
The above works if the field has no formatter attached. How to I get this event when there is a formatter+TextInputController?
Thanks.
fixed by #21