Click or drag to resize

ExpandItemToVariableSizeExample Class

A list of items similar to the ContentSizeFitterExample, but items can be expanded/collapsed
Inheritance Hierarchy
SystemObject
  Object
    Component
      Behaviour
        MonoBehaviour
          Com.ForbiddenByte.OSA.CoreOSAMyParams, MyVH
            Com.ForbiddenByte.OSA.Demos.ExpandToVariableSizeExpandItemToVariableSizeExample

Namespace:  Com.ForbiddenByte.OSA.Demos.ExpandToVariableSize
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
public class ExpandItemToVariableSizeExample : OSA<MyParams, MyVH>

The ExpandItemToVariableSizeExample type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyLazyData
Top
Methods
  NameDescription
Public methodChangeItemsCount (Overrides OSATParams, TItemViewsHolderChangeItemsCount(ItemCountChangeMode, Int32, Int32, Boolean, Boolean).)
Protected methodCreateViewsHolder

Called when there are no recyclable views for itemIndex. Provide a new viewsholder instance for itemIndex. This is the place where you must initialize the viewsholder

via Init(GameObject, RectTransform, Int32, Boolean, Boolean) shortcut or manually set its itemIndex, instantiate the prefab and call its CollectViews

(Overrides OSATParams, TItemViewsHolderCreateViewsHolder(Int32).)
Protected methodOnInitialized (Overrides OSATParams, TItemViewsHolderOnInitialized.)
Protected methodRebuildLayoutDueToScrollViewSizeChange

Called mainly when it's detected that the scroll view's size has changed. Marks everything for a layout rebuild and then calls Canvas.ForceUpdateCanvases().

IMPORTANT: Make sure to override MarkForRebuild in your views holder implementation if you have child layout groups and call LayoutRebuilder.MarkForRebuild() on them

After this call, Refresh(Boolean, Boolean) will be called

(Overrides OSATParams, TItemViewsHolderRebuildLayoutDueToScrollViewSizeChange.)
Protected methodStart (Overrides OSATParams, TItemViewsHolderStart.)
Protected methodUpdate (Overrides OSATParams, TItemViewsHolderUpdate.)
Protected methodUpdateViewsHolder

Here the data in your model should be bound to the views. Use newOrRecycled.ItemIndex (ItemIndex) to retrieve its associated model

Note that views holders are re-used (this is the main purpose of this adapter), so a views holder's views will contain data from its previously associated model and if,

for example, you're downloading an image to be set as an icon, it makes sense to first clear the previous one (and probably temporarily replace it with a generic "Loading" image)

Note that this is not called for items that will remain visible after an Insert or Remove operation is done

(Overrides OSATParams, TItemViewsHolderUpdateViewsHolder(TItemViewsHolder).)
Top
Version Information

Optimized ScrollView Adapter

Supported in: 4.3
See Also