I have a UIViewController with a UIScrollView inside of it. This scroll view contains some UITextFields inside of it and I want to be able to scroll the view according to the field in focus. My question is: is there a way to detect when the first responder in a UIViewController change? So I can get it's frame and change the scroll view offset to make it on top of the keyboard. I already use the keyboardWillShowNotification to get keyboard size changes. But when keyboard is already being shown and another text field becomes the first responder no changes are made in the keyboard and I can't detect which is the new first responder.
Updates:
- The Scroll View is in a Container View Controller, so the text fields are added and
UITextFieldDelegatemay not work for this. Unless I can set the delegates after adding the content of the container. - I already manage the keyboard notifications, they don't cover all cases.
- There are
UITextViews in the form too.