Author Topic: UIWrapContent Automatically Centering  (Read 4832 times)

dustinRodda

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
UIWrapContent Automatically Centering
« on: June 30, 2014, 09:35:38 AM »
I am trying to create an infinite scrolling list using UIWrapContent.  I am running into an issue where all the children in my WrapContent get centered inside of the ScrollView.  I would really like to start the list at the top of the ScrollView instead.  I have tried repositioning the children in the WrapContent and the WrapContent itself through code, but neither solved the issue.  Any suggestions?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIWrapContent Automatically Centering
« Reply #1 on: July 01, 2014, 04:01:46 AM »
Move the object that has UIWrapContent higher so that it's at the top of the scroll view.

dustinRodda

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: UIWrapContent Automatically Centering
« Reply #2 on: July 01, 2014, 08:45:15 AM »
I have tried that. Here is my setup.  The first two are from the inspector the third is the location of the wrap content in the scene.  I am using the structure from Example Project 14.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIWrapContent Automatically Centering
« Reply #3 on: July 02, 2014, 03:46:54 AM »
That looks correct to me and I see you are already using the 14th example as a reference, so that's good. Can you post a pic of what it looks like when you populate the content? From what I see it should behave just like the lists in the example -- first item will be at the same position as the wrap content object, and others will be below it.

dustinRodda

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: UIWrapContent Automatically Centering
« Reply #4 on: July 02, 2014, 03:26:03 PM »
here is what it looks like after population.  The position of the wrap content is at the top of the window as suggested.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIWrapContent Automatically Centering
« Reply #5 on: July 03, 2014, 04:42:30 AM »
Alright, so where is your UIWrapContent object positioned? All children will start at that object's transform position and move either down or right, depending on the scroll view's direction. If you move that object, its children will move with it. You said you tried that, but why didn't it work then? It's just an object. Moving it around will move its children.