I'm using custom UITableViewCell
s inside my UITableView
. Each of these UITableViewCell
s is pretty high and contains a UITextField
at the top.
When a user taps the UITextField
in order to edit it, a keyboard appears and the UITableView
scrolls automatically so that the cell is at the top of the screen.
The problem is that this scrolls the UITableView
to the bottom of the UITableViewCell
, not the top. When the UITableViewCell
is high and edited the UITextField
is at the top so you can't see the UITextField
. I know how to scroll the UITableView
programmatically, but I just don't know how to disable this automatic scrolling so that I can scroll the UITableView
on my own. How can I do this?
Define properties for your
UITableViewController
:Before you call
becomeFirstResponder
:Add the following code to your table view controller:
After you call
resignFirstResponder
, setscrollDisabled = NO
.You can do the following:
Then implement this UIScrollViewDelegate method
!!! But be warned, that if the user taps in a location in the UITextField that will be covered by the Keyboard, then it won't scroll.
From my point of view, the best thing to do is to make sure that all the cells from top to then one with the UITextField included, will be visible when then Keyboard will show.