【ID1009737】

【滑动界面】可上下滑动的界面设定一个滑动上限
dev_chengFeng
jiaoyangna 2021-08-04 15:52:30 +08:00
parent 8eb63b7692
commit 488b7469f6
1 changed files with 11 additions and 11 deletions

View File

@ -262,16 +262,7 @@ function ScrollCycleView:OnDestroy()
end
--界面打开时调用(用于子类重写)
function ScrollCycleView:OnOpen(itemGO, scrollBar, scrollSizeDeltaV2, dragType, fixedCount, spacingV2,maxOffSet)
if not maxOffSet then
if not self.elastic then
self.maxOffSet = 0
else
self.maxOffSet = 500
end
else
self.maxOffSet = maxOffSet
end
function ScrollCycleView:OnOpen(itemGO, scrollBar, scrollSizeDeltaV2, dragType, fixedCount, spacingV2)
self.gameObject:SetActive(true)
self.item = itemGO --关联的预设
self.scrollBar = scrollBar --关联scrollBar组件
@ -315,7 +306,16 @@ function ScrollCycleView:OnOpen(itemGO, scrollBar, scrollSizeDeltaV2, dragType,
self.dragGOTran.anchoredPosition = Vector2.New(0, 0)
end
function this:SetData(dataList, updateFunc, noTop, noAnim)
function this:SetData(dataList, updateFunc, noTop, noAnim,maxOffSet)
if not maxOffSet then
if not self.elastic then
self.maxOffSet = 0
else
self.maxOffSet = 500
end
else
self.maxOffSet = maxOffSet
end
self.dataList = dataList --传入的数据列表
self.updateFunc = updateFunc --刷新回调,返回数据列表的索引和对应预设
self.dataCount = #dataList