Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: safety on June 20, 2014, 02:48:25 AM

Title: Adding dynamic text to a scrolling UITable
Post by: safety on June 20, 2014, 02:48:25 AM
I’m trying to dynamically populate a scrolling UITable (1 column) with text downloaded from a server. My approach is to create text labels dynamically, set their width to apply line-wrapping, then add them to the table. Depending on when this is done, the text label's position seems to jump around the place, making it difficult to know what the table offset into the scrollview should be.  I don’t know how wide the scrollview is going to be until it is sized (OnEnable), so I can’t hardcode an offset.

Is there a recommended way to do this?
Title: Re: Adding dynamic text to a scrolling UITable
Post by: ArenMook on June 21, 2014, 02:32:17 PM
After setting your label's content you should call Reposition() on the table so that everything is positioned correctly. Are you doing that?
Title: Re: Adding dynamic text to a scrolling UITable
Post by: safety on June 22, 2014, 10:12:51 PM
After adding a call to Reposition() on the UITable and ResetPosition() on the UIScroll it appears to set the text position consistently. Thanks!