I'm having an issue with UITableView
where it doesn't seem to handle scrolling to the last row properly when using scrollToRowAtIndexPath:atScrollPosition:animated
Here's the code I'm using to cause the scroll:
[self.tableView scrollToRowAtIndexPath:indexPath
atScrollPosition:UITableViewScrollPositionMiddle
animated:YES];
And here's a screenshot showing the result (and the issue!):
As you can see, the very last row (September) isn't scrolled fully into view; the bottom few pixels are cut-off.
I've tried using UITableViewScrollPositionNone
, UITableViewScrollPositionTop
and UITableViewScrollPositionBottom
as the scroll position but they all produce the same result.
My cell does have a custom cell height of 61.0f
which is currently set in the storyboard, but adding the UITableViewDelegate
method tableView:heightForRowAtIndexPath:
and returning the same value doesn't help either.
Is there any way I can get the table view to scroll to the last row AND have it fully visible?
EDIT:
Just to be clear, I'm using a stock UINavigationController
with a stock UITableViewController
as it's root view controller.
EDIT 2:
If I use rectForRowAtIndexPath:
to determine the rect for the row, it does in-fact return the correct rect for that row. But if I then call scrollRectToVisible:animated:
using that rect, I get the same result as above; the bottom few pixels are cut-off.