## iOS ListView is scrolling to the wrong ViewCell after a call to ForceUpdateSize.

_Submitted by a community member on 2016-04-15 09:59 UTC_

Steps to reproduce (Tested on simulator iPad Retina iOS 9.3):

1\. Compile and run the attached application. (ResizeIssues)
2\. Scroll down to section 10 and tap the plus sign.
3\. Tap the "more" button that appears.
4\. Scroll down to section 13 and tap the plus sign. [THE LIST THEN SCROLLS BACK UP TO SECTION 10 REMOVING SECTION 13 FROM VIEW]
5\. Scroll to Section 4 and tap the plus sign.
6\. Tap the "more" label that appears.
7\. Scroll back to section 13 and tap the "More" label. [THE SCREEN SCROLLS UP SO THAT WE CAN SEE THE TOP OF THE BOTTOM OF SECTION 4 AND THE TOP OF SETCION 10]
8\. Scroll back to section 13 and tap the "Less" label. [SCREEN SCROLLS UP SO WE CAN SEE ALL OF SECTION 10]
9\. Repeat the process many times of scrolling to section 13 and tapping the "More"/"Less" label. [DO THIS ENOUGH TIMES AND THE LIST WILL SCROLL UP TO SHOW ALL OF SECTION 4.]

Repeating step 9 many times seems to cause the list to scroll to one of 3 positions:
```
	a. Section 10 visible.
	b. Bottom of section 4 visible, top of section 10 visible.
	c. Section 4 visible.
```

This can be reproduced with other combinations of selections. 

I also tested on an iPad and the sequence of steps detailed above did not manifest the problem but it did still occur whilst tapping around on the "plus/minus" and "more/less" controls. The problem occurred less on an iPad but still occurred intermittently.

I have yet to find a work around to this problem. All attempts to programmatically scroll to the selected item seem to get overridden by the behaviour detailed above.

Could it please be fixed.

* * *

_Xamarin Bugzilla comment 1 by a community member on 2016-09-16 15:12 UTC_

We have had another look at this and the problem still exists in the latest version of Xamarin Forms. 

The problem can even be seen in your own test project:
<https://developer.xamarin.com/samples/xamarin-forms/UserInterface%5CListView%5CDynamicUnevenListCells/>

Do you have any plans to fix this problem?

* * *

_Xamarin Bugzilla comment 2 by a community member on 2016-09-16 15:36 UTC_

Much research has implied this is caused by an issue introduced in iOS when using the tableView.RowHeight = UITableView.AutomaticDimension option.
It is necessary to ensure that HeightForRowAtIndexPath provides the current height of all rows in the TableView, otherwise when tableView.ReloadRows is called it attempts to reset the ContentOffset of the list incorrectly based on an incorrect understanding of how high each row in the TableView is.

* * *

<br />

_Reference: <https://bugzilla.xamarin.com/show_bug.cgi?id=40432>_