Hello Guest

Author Topic: Trouble Centering items in UILayout Container Sizer.  (Read 3319 times)

soulareus

  • Newbie
  • *
  • Posts: 2
    • View Profile
Trouble Centering items in UILayout Container Sizer.
« on: April 03, 2014, 05:54:38 am »
I think the new UILayout Container Sizer is a great idea!  However I am having trouble figuring out how to do two things:

1) I want to use it to dynamically add objects and remove them and have it collapse properly.
2) I want a horizontally aligned list of objects to center when I add or remove items.

I could not find any script reference for this container sizer, and parenting a UILayout does not seem to center the container sizer.  Could someone please let me know if this is possible?  It has implications for a couple of projects I am working on.

Thanks!
-Nic

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Trouble Centering items in UILayout Container Sizer.
« Reply #1 on: April 06, 2014, 12:29:34 pm »
1. That just works. Check ui demo 5  - The function that adds stuff into a layout is in tk2dUIDemo5Controller.AddSomeItemsAuto, the relevant function is - "autoScrollableArea.ContentLayoutContainer.AddLayoutAtIndex" which adds an item. Similarly there is a RemoveLayout which removes an item from a layout, but you are still responsible for deleting the game object.

2. There isn't, after removing an item, you can force scroll to the centre of the scrollable area.