文档详情

使用说明instructions指示.pdf

发布:2024-12-10约6.59千字共4页下载文档
文本预览下载声明

USAGEINSTRUCTIONS

ScrollrectItemsAdapter8,BaseParamsandBaseItemViewsHolderarethe3coreclassesinoursmall

librarydedicatedtobothoptimizeaScrollViewandprogrammaticallymanageitscontents.

YoucanuseitbothforahorizontalandverticalScrollView.

ScrollrectItemsAdapter8it’sanclass,becauseyouneedtoprovidetheheightorwidth

(dependingifit’saverticalorhorizontalScrollRect)ofeachitem(viayourimplementationof

ScrollrectItemsAdapter8.GetItem[Height/Width](intindex)callback)andtopopulatetheviewswith

dataforeachitem(viayourimplementationof

ScrollrectItemsAdapter8.InitOrUpdateItemViewHolder(BaseItemViewsHolderviewsHolder)callback).

ItsrecommendedtomanuallygothroughexamplecodeprovidedinScrollRectItemsAdapterExample.cs

andSimpleTutorial.csinordertofullyunderstandthemechanism.You’llfinddetailedcommentsin

coreareas.Youmayevenusethisscriptdirectlywithoutimplementingyourown,insomesimple

scenarios.

(Somemayfinditmoreeasytoconsulttheexamplecode+scenedirectly,withoutreadingthistutorial)

IMPLEMENTATION

(Followthesestepswhileconstantlylookingathowit’sdoneintheexamplecodeinSimpleTutorial.cs

andoptionallyinScrollRectItemsAdapterExample.cs)

Here’sthenormalflowyou’llfollowafteryou’vecreatedaScrollViewusingGameObject-UI-Scroll

View:

1.createyourownimplementationofBaseItemViewsHolder,letsnameitMyItemViewsHolder

2.createyourownimplementationofBaseParams(ifneeded),letsnameitMyParams

3.createyourownimplementationofScrollRectItemsAdapter8MyParams,MyItemViewsHolder,lets

nameitMyScrollRectItemsAdapter

4.instantiateMyScrollRectItemsAdapter

5.callMyScrollRectItemsAdapter.ChangeItemCountTo(intcount)once(andanytimeyourdatasetis

changed)andtwothingswillhappen:

5.1.iftheScrollRecthasverticalscrolling,MyScrollRectItemsAdapter.GetItemHeight(intindex)

will

显示全部
相似文档