Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: briangibson on August 10, 2014, 01:20:18 PM

Title: Reset scrollview containing a UIGrid to top left
Post by: briangibson on August 10, 2014, 01:20:18 PM
I instantiate a bunch of UIGrid items on application start. I want to make sure that it scrolls immediately to the top left of the scrollview as soon as the app starts. what is the best way to do this? I tried all these things, and they don't seem to do it:
      scrollView.ResetPosition();
      scrollView.restrictWithinPanel = true;
      scrollView.RestrictWithinBounds(true);
      grid.repositionNow = true;


Title: Re: Reset scrollview containing a UIGrid to top left
Post by: briangibson on August 10, 2014, 01:30:52 PM
this seemed like it maybe worked. http://www.tasharen.com/forum/index.php?topic=9476.msg44658#msg44658
Title: Re: Reset scrollview containing a UIGrid to top left
Post by: briangibson on August 17, 2014, 11:18:41 PM
false alarm... this doesn't always work. =/ i'm baffled.
Title: Re: Reset scrollview containing a UIGrid to top left
Post by: ArenMook on August 18, 2014, 11:51:25 AM
When you enable or instantiate some UI element, it is not added to the panel right away. Scroll view has no knowledge of it at this point. You need to force it to happen right away by broadcasting "CreatePanel" on the object you instantiated.