scrollRectToVisible for a UITableView doesn't always take section headers into account

Viewed 126

I have a UITableView in which I'm using section headers. The contents of the table view are text form fields. I have a "next/previous" control on the keyboard toolbar, and I use scrollRectToVisible to scroll the form field to make particular rows visible. next works fine-- the field ends up immediately above the keyboard. I'm having a problem with previous in some cases, however. In some cases, with fields near the top of the table view, scrollRectToVisible appears to not take into account the section headers. After scrollRectToVisible operates, the view is not fully visible -- rather it is occluded by the section header.

For example, in the following, this is immediately after pressing Previous and scrollRectToVisible finishes. The cursor is positioned where the arrow is pointing. The phone number field is occluded by the "Phone" section header.

enter image description here

I have tried a) first getting the index path of the row in question, and b) then using scrollToRow. Oddly that's not always working for me. The row I need isn't always visible after.

Suggestions?

0 Answers
Related