danielamitay/DAKeyboardControl

Action handler called twice when text view becomes first responder

Closed this issue · 4 comments

ide commented

When a text view becomes the first responder, the block passed to addKeyboardPanningWithActionHandler: is invoked twice. The first time, it is passed the fully expanded keyboard frame with opening=NO and closing=NO. The second time, it is passed the same arguments except with opening=YES.

I'm running into an issue where I want to handle changes in the keyboard position differently depending on whether it moved due to panning or not. What I want is for the the action handler to be invoked just once when the text view becomes the first responder. Removing support of iOS 4.x solves this; I'll submit a PR so you can take a look.

ide commented

Figured out a workaround by using scrollView.tracking; closing this out.

Hi Ide,

Can you please share your workaround? I've noticed the handler is called twice too, with opening=NO and closing=NO the first time and opening=YES and closing=NO the second time. Not sure if this is intended behavior. Hope you can shed some light on how you've addressed this.

Thanks!

ide commented

I haven't used this library in over a year, I forget what I did, sorry.

Thanks for your quick response. The handler being called twice is indeed intended behavior. It turned out my issue was not related to this library.