Author Topic: Adding dynamic text to a scrolling UITable  (Read 1508 times)

safety

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 2
    • View Profile
Adding dynamic text to a scrolling UITable
« 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?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Adding dynamic text to a scrolling UITable
« Reply #1 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?

safety

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Adding dynamic text to a scrolling UITable
« Reply #2 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!