When multiple uitextfields in uitableview are blocked by the keyboard, how can this problem be solved?

Source: Internet
Author: User

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
  1. -(Void) textfielddidbeginediting :( uitextfield *) textfield {
  2. [Self. tableview setcontentoffset: cgpointmake (0, 70) animated: Yes];
  3. }

 

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
  1. -(Bool) textfieldshouldreturn :( uitextfield *) sender {
  2. [Self. tableview setcontentoffset: cgpointmake (0, 0) animated: Yes];
  3. Return yes;
  4. }

When multiple uitextfields in uitableview are blocked by the keyboard, how can this problem be solved?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.