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

Question about isFirstResponder #142

Closed
ibeleliev opened this issue Jun 15, 2020 · 3 comments
Closed

Question about isFirstResponder #142

ibeleliev opened this issue Jun 15, 2020 · 3 comments

Comments

@ibeleliev
Copy link

I found recently this library and started using it, but i came across something that i can't figure out how to deal with.
In my code i have specific closures that i want to run when the focus is not on the WSTagsField instance. For this purpose i set the 'textDelegate' to my controller and im running the closures inside textFieldDidEndEditing. It was working fine as expected until i tried to use the backspace key in the keyboard that shows when a view becomes the first responder. I understand that textFieldDidEndEditing wouldn't be the place for my closures to be in because the instance is still the firstResponder at this point just not the textField inside the instance.
I tried looking at the WSTagsField.isFirstResponder inside textFieldDidEndEditing but did not got what i was expecting.
So my question is: Is there a better place or some event like the ones "onDidAddTag,.. etc" that i could use to monitor when the WSTagsField is indeed resigning the first responder ?

@ricardopereira
Copy link
Member

@ibeleliev I'm not sure if I quite understood your question. What are you trying to achieve? You only what assign events when the field is the first responder?

@ibeleliev
Copy link
Author

Well I need a way to do something when the WSTagsField instance is not a firstResponder anymore. Like for example in my case after both the textField and the WSTagView's instances are not first responders.
I see that after the textField resignsFirstResponder ( when using the delete/backspace key on the keyboard ) the WSTagView before the typing indicator is becoming the firstResponder, and what i want is to know when every component of the library is not the firstResponder anymore.

PS. I don't know if i'm explaining myself well :)

@ibeleliev
Copy link
Author

A workaround that i use now is to fire a timer when textFieldDidEndEditing is called and check in the timer if WSTagsField.isFirstResponder is false. If it is false I execute my closures.
Sorry for the english it is not my native, and the explanations :)

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

2 participants