Reputation: 6795
This question is linked to my other question here, but this is a more focused part of the problem I'm facing.
I have 5 text fields, and I want to move the (scroll) view so the keyboard doesn't hide the active field. I have implemented keyboardWillShow: text field delegate method as per standard Apple recommended approach, and it works well for when I tap on any text field the first time.
However, I have replaced the Return button on the keyboard with Next button. When it is pressed, the focus jumps onto the next text field. And since the keyboard in the process is neither hidden nor shown again, my keyboardWillShow: method is not called - I see this from the NSLogs I've placed there which are not appearing in console.
Any ideas how I can force the re-calculation of keyboard height when I click Next? One thing I understand is that in order to get the keyboard height (I don't want to use hard-coded heights), I need to keep the calculations in a methods that takes aNotification as an argument.
Any ideas or suggestions?
Upvotes: 0
Views: 67
Reputation: 80265
Of course keyboardWillShow
is not called as you stated correctly.
Just use textField:didEndEditing
, or better textField:shouldBeginEditing
of the next text field, and use the same logic.
To solve the keyboard height and location problem, keep a variable with the data you need and use the usual notification hooks to keep it up to date.
Upvotes: 1