In uitableview, many forms often need to be input. Some forms depend on each other, and the keyboard pops up when one click is input. Sometimes the input box is covered. What should I do?
Call the following method. Of course, the uitextfield you enter must have delegate = self. The current viewcontroller must implement uitextfielddelegate.
[CPP]View plaincopy
- -(Void) textfielddidbeginediting :( uitextfield *) textfield {
- [Self. tableview setcontentoffset: cgpointmake (0, 70) animated: Yes];
- }
This indicates that when the input starts, tableview raises 70 distances from the original one. You can use multiple uitextfiled to adjust the height of cgpoint. I am writing 70.
The scrollenabled attribute of tableview must be yes; otherwise, it cannot be rolled.
Remember to restore the tableview position at return:
[CPP]View plaincopy
- -(Bool) textfieldshouldreturn :( uitextfield *) sender {
- [Self. tableview setcontentoffset: cgpointmake (0, 0) animated: Yes];
- Return yes;
- }
When multiple uitextfields in uitableview are blocked by the keyboard, how can this problem be solved?