I implemented a TableView to show up a PickerView when a particular row is selected. But that would sometime block the selected cell. So, I want my scrollView to scroll to the selected cell when the pickerView shows up.
Is there anyway to get the current location of the selected row? Such that I can implement something like
//---scroll to the current text field---
CGRect textFieldRect = [currentTextField frame];
[scrollView scrollRectToVisible:textFieldRect animated:YES];
Thanks.
If you want to solve the pickerView or the keyboard hiding the screen, you can try this approach. Implement the
heightForFooterInSectionand set a height value, and the tableView will scroll up to the same value as you specify there.If you just want the tableView to scroll , just implement the
scrollToRowAtIndexPath:atScrollPosition:animated:Edit:
Since you are using a
UIScrollView, you can programmatically scroll to a certain region usingAlso read through this reference: http://www.aaron.griffith.name/weblog/2011/02/23/scrolling-a-uiscrollview-programmatically/