Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: DZP on November 07, 2013, 10:28:06 AM

Title: Expanding elements in a UIGrid
Post by: DZP on November 07, 2013, 10:28:06 AM
Hey there,

I am working on making a UIGrid with expanding elements for a shop interface. Simply you click on one of the elements in a vertical shop and the image expands down and reveals more information.

I have an extended UIGrid that can have cells with different heights but I'm having problems with the bounds of the UIGrid. I can see the bounds dictated by the orange box in the editor. When I change the sprite height of an element in the grid the bounds goes all silly. I have demonstrated this by the 2 screenshots.

I looked in UIGrid.cs and could not see how the boundaries are being set. Could you please point me in the right direction or would I be better off writing my own Grid class to manage a collection of elements with dynamic sizes?

Thanks in advance. Forgive the lovely placeholder images....

EDIT: I am using the latest version of NGUI with Unity 4.2
Title: Re: Expanding elements in a UIGrid
Post by: ArenMook on November 08, 2013, 10:20:38 AM
Have you looked at UITable? Because that's exactly what it does -- lets you resize content elements while still keeping them positioned.

Look at the quest log example.
Title: Re: Expanding elements in a UIGrid
Post by: DZP on November 08, 2013, 10:34:11 AM
Have you looked at UITable? Because that's exactly what it does -- lets you resize content elements while still keeping them positioned.

Look at the quest log example.

Thanks, that's saved me some time! Why does UIGrid not have the same functionality out of curiosity?
Title: Re: Expanding elements in a UIGrid
Post by: ArenMook on November 08, 2013, 10:44:20 AM
Because UITable is a lot slower than a UIGrid.