IOS about TableView There are multiple TextField, the input box is obscured by the workaround

Source: Internet
Author: User

Here, the method of TableView is used to move the whole.

Code: (where 60 is the height of the cell)

//Click on the input box to trigger- (void) Textfielddidbeginediting: (Uitextfield *) textfield{//Keyboard HeightCGFloat keyboardheight =216.0f; //Get TagNSLog (@"Hhhhh = = =%d", Textfield.tag); //determine if the height of the keyboard is obscured by the input box, more than how much distance, moving how much distance (you can do it well, not necessarily the same as here)    if(Self.tableviews.bounds.size.height-keyboardheight- -* (Textfield.tag +1) <0&&self.tableviews.bounds.size.height-keyboardheight- -* (Textfield.tag +1) >- -) {[Self.tableviews Setcontentoffset:cgpointmake (0, -) Animated:yes]; }    Else if(Self.tableviews.bounds.size.height-keyboardheight- -* (Textfield.tag +1) <- -&&self.tableviews.bounds.size.height-keyboardheight- -* (Textfield.tag +1) >- -) {[Self.tableviews Setcontentoffset:cgpointmake (0, the) Animated:yes]; }    Else if(Self.tableviews.bounds.size.height-keyboardheight- -* (Textfield.tag +1) <- -&&self.tableviews.bounds.size.height-keyboardheight- -* (Textfield.tag +1) >- the) {[Self.tableviews Setcontentoffset:cgpointmake (0, the) Animated:yes]; }}//keyboard Retract trigger- (void) Textfielddidendediting: (Uitextfield *) textfield{//return to the same place[Self.tableviews Setcontentoffset:cgpointmake (0,0) Animated:yes];}

IOS about TableView There are multiple TextField, the input box is obscured by the workaround

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.