Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: davitosan on November 02, 2017, 08:14:58 PM

Title: UIWrapContent ItemHeight (itemSize)
Post by: davitosan on November 02, 2017, 08:14:58 PM
I have a ScrollView with an unknown number of items, because of this I am using UIWrapContent.

The design calls for this scroll view to have items organized by categories. At the start of each category the design calls for a 'label' item.
The desire is to have the 'label' item to be smaller then the actual items. If they were all the same size it would look odd.

From what I can gather, UIWrapContent only supports constant item sizes.

Does UIWrapContent support items of varying sizes?
(3.9.4)

Thank you.
Title: Re: UIWrapContent ItemHeight (itemSize)
Post by: ArenMook on November 06, 2017, 07:29:12 AM
UIWrapContent will change the widget's size to envelop the specified root object and all of its children. UIWrapContent should be on that object's sibling. It shouldn't be used with scroll views, however. It's meant to resize widgets. The only way to use it to adjust the scroll view's dimensions is to make the scroll view a child of the UIWrapContent's widget, anchored to it. Just make sure you aren't trying to envelop the object's own children. Only siblings' children can be used, otherwise the script will count its own dimensions, resulting in an undefined behaviour.
Title: Re: UIWrapContent ItemHeight (itemSize)
Post by: davitosan on November 06, 2017, 04:41:25 PM
I don't understand how adjusting the scroll view's dimensions help with having different sized content.
I don't think I explained my question correctly. Here is an image of what I'm trying to accomplish.

(https://i.imgur.com/KvXUUWW.jpg)
Title: Re: UIWrapContent ItemHeight (itemSize)
Post by: ArenMook on November 09, 2017, 08:06:41 PM
Place all your items underneath your "Label Item" object underneath a UIGrid. Put a UITable on the root object containing your Label Item objects. UIWrapContent is not going to help you here.

Panel ScrollView
- UITable
-- Label Item
--- UIGrid, TweenScale
---- Item1
---- Item2
---- Item3
-- Label Item
--- UIGrid, TweenScale
---- Item1
---- Item2
---- Item3

TweenScale should animate the transform's Y scale to shrink the object. Just check the Quest Log example for how it's used.