Author Topic: UIDragScrollView anchor in one direction only?  (Read 2944 times)

Arcanor

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 46
    • View Profile
UIDragScrollView anchor in one direction only?
« on: February 12, 2014, 11:06:44 AM »
I have a UIScrollView on a panel, set to Vertical movement.  The scroll view has one child, which is a UIGrid containing a dynamic list of buttons.  The UIGrid and all its children (the buttons) have UIDragScrollView components on them.

Vertical scrolling is working fine.  The problem is that I can't figure out how to position the grid horizontally without using absolute pixel position (which makes the grid off-center in the scroll view when the main game window is resized).

What I'd like to do is anchor the grid to the parent scrollview horizontally, while letting it still be draggable vertically.  Is there a way to apply an anchor in one direction only?

Arcanor

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 46
    • View Profile
Re: UIDragScrollView anchor in one direction only?
« Reply #1 on: February 12, 2014, 11:10:32 AM »
Wow.  I've been struggling with this issue for weeks, and one minute after I post the question I figure out the solution.

For others with this same question, the solution is Advanced anchoring.  The key is to anchor the Left and Right to the scrollview, but set the Bottom and Top anchors to None.

Happy anchoring!