简体   繁体   中英

UItableview and Keyboard with previous and next button scrolling issue - iPhone

Here I have a tableView on a scrollView. Each row contains a textField. Next button is ok(view animating properly on upword) but when I press on previous button on keyboard, I have to show down the view one by one according to the textField. How can I solve this? I have to do it in many views. Please help me as soon as possible. I badly need it. May be I'm doing wrong somewhere. Sorry for my language problem. Sample code may be helpful.

Hi Please try the below method to scroll your tableview up and down based on which text field is selected, write this code in textfield delegate method

- (void)textFieldDidEndEditing:(UITextField *)textField{

  // calculate the nsindexpath based on the textfield which is selected

 //- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated;

[yourtableview scrollToRowAtIndexPath:calcutaedIndexPath atScrollPosition:UIScrollViewPositionTop animated:YES];

}

Hope it will help you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM