Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set the delegate? #8

Closed
ntkon opened this issue Jun 27, 2018 · 4 comments
Closed

How to set the delegate? #8

ntkon opened this issue Jun 27, 2018 · 4 comments

Comments

@ntkon
Copy link

ntkon commented Jun 27, 2018

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))

@luximetr
Copy link
Owner

luximetr commented Jun 27, 2018 via email

@ntkon
Copy link
Author

ntkon commented Jun 27, 2018

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?

@ntkon
Copy link
Author

ntkon commented Jun 28, 2018

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.

@SergeyKovalenko
Copy link

fixed by #21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants