Author Topic: dynamically attaching a button to a scrollable element inside a scrollview  (Read 3326 times)

Nubeh

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 41
    • View Profile
I have a scrollview with some images in it and I want to show a button under the images when one is pressed. I created a button object and when one of the images is clicked I anchor the button to the bottom of the image. This works fine except that if I scroll my view the clipping area doesn't affect my button because it's not "inside" the grid.

I tried to parent the object to the clicked image and then anchor it but I got a weird behaviour: the button's Y position keeps diminishing over time (thus going outside the screen) after doing that for some reason. I tried to parent the button and then call Reposition() on the grid but it didn't work, same behaviour.

So what's the correct way to parent a button object to a scrollview element dynamically?

Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: dynamically attaching a button to a scrollable element inside a scrollview
« Reply #1 on: November 01, 2013, 08:42:41 AM »
If you want something to be below something else, just make it a child and move it down a bit. You don't even need to use anchors.