Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Teric on April 18, 2014, 12:30:30 PM
-
I have set up a scrollable list using a UIScrollView component. The child of the scroll view is a UITable, which in turn has a number of instantiated prefabs added to it at run-time. All seems to work well, except for the fact that when the scroll view is first created and populated during run-time, the list of objects appears to be positioned a bit downward from where it should be (see attached picture).
As soon as I click and drag the list, it automatically resets itself to the correct position, and then allows me to drag it normally. I have attempted the following things to fix this issue, but none of them have fixed the problem:
1. Setting anchors to 'none' in the UIPanel component on the scroll view object
2. Setting the content origin to 'top' in the UIScrollView component
3. Adding/Removing a SpringPanel component
4. In code, calling ResetPosition() on the UIScrollView object, and then destroying and detaching all children of the UITable object before populating it with new prefabs
We're scratching our heads over here--anyone seen a problem like this before?
-
Either move up the table's game object by however many pixels it's short by, or call UIScrollView's UpdatePosition() after setting up your content.
-
Thank you very much, Aren! It looks like that did exactly what we needed.
-
@Aren: I have got similar issue with ngui's scrollview. I am creating a table as a child of scrollview and for the first time alone ,the table including the cells gets offseted from the starting position of the scrollview. However from the next time it automatically gets shifted to the start. I want to know how you solved it. Thanks!
-
Exactly as I mentioned in the previous post. Call UpdatePosition(), or if you're doing it at edit time -- right click on the scroll view and choose Reset Clipping Position. Might want to set the scroll view's origin too though.