Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Holy Manfred on July 17, 2015, 10:48:45 AM
-
Hi there,
I have a ScrollView with a table child and a bunch of entries in it. Pretty simple setup:
+ScrollView
+UITable
+++Entry1
+++Entry2
+++...
When clicking on an item in the table I want it to center on it. This also works well, however I would like to set the position inside the table where the clicked item will be centered. This is how it looks right now:
(http://www.metalpopgames.com/images/center.jpg)
What would be the best way to set it up so that clicked items align with the top of the ScrollView and not the bottom? Bascially I would like the top border of my entry to be aligned with the top of the visible area of the ScrollView. I hope this makes sense :) I am thinking there might be a simple setting or checkbox I overlooked.
Thanks!
-
Assuming you used UICenterOnClick / UICenterOnChild, it simply centers on the child transform's position. Sub-children of that child can be moved around as you see fit.
-
Thanks for your suggestion.
Turns out my issue was related to the parent object of the scroll view. When UICenterOnClick'ing the clicked element would center on the pivot of the parent object of the object holding my scroll view. Not sure if this is intended though, since I was assuming UICenterOnClick would use the pivot of the scroll view an not its parent object. Anyway, to fix it I just had to adjust the center position of the parent widget, so it was an easy fix in the end.