When using selectRowAtIndexPath:animated:scrollPosition:
, I am passing in UITableViewScrollPositionNone
. Despite the name, I am expecting the tableview to scroll when necessary so that the row is visible (and not scroll if it is already visible).
UITableViewScrollPositionNone - The table view scrolls the row of interest to be fully visible with a minimum of movement. If the row is already fully visible, no scrolling occurs. For example, if the row is above the visible area, the behavior is identical to that specified by UITableViewScrollPositionTop. This is the default.
However, I am finding that the table view does not scroll at all. If I use UITableViewScrollPositionTop
or UITableViewScrollPositionBottom
, the table view scrolls as expected.
Can it be possible that the documentation for this is incorrect? Or am I missing something?
The documentation for UITableView's selectRowAtIndexPath:animated:scrollPosition: has a section that describes what you are experiencing.
Special Considerations Passing UITableViewScrollPositionNone will result in no scrolling, rather than the minimum scrolling described for that constant. To scroll to the newly selected row with minimum scrolling, select the row using this method with UITableViewScrollPositionNone, then call scrollToRowAtIndexPath:atScrollPosition:animated: with UITableViewScrollPositionNone.
Hope that helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With