Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Nubeh on October 30, 2013, 08:57:57 AM

Title: dynamically attaching a button to a scrollable element inside a scrollview
Post by: Nubeh on October 30, 2013, 08:57:57 AM
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
Title: Re: dynamically attaching a button to a scrollable element inside a scrollview
Post by: ArenMook 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.