我在記分牌查看中遇到問題。我在滾動視圖中給我的滾動視圖和內容賦予初始值。當我開始打開計分板時,內容顯示在正確的位置,但是當我將它滾動然後向上滾動時,它並沒有達到其初始位置。 請檢查記分牌視圖的附件截圖。任何人都可以告訴我在這種情況下該做什麼?在Corona SDK中沒有得到正確的滾動視圖
在此先感謝。
local function scrollListener(event)
local phase = event.phase
if phase == "began" then
print("Scroll view was touched")
for key,value in pairs(event) do
print("pranav",key,value)
end
elseif phase == "moved" then
--print("Scroll view was moved")
print("over",event.x)
if(event.x>414)then
event.x=358
end
elseif phase == "ended" then
print("Scroll view was released")
print("ended",event.x)
end
-- In the event a scroll limit is reached...
if event.limitReached then
if event.direction == "up" then
print "Reached top limit"
elseif event.direction == "down" then
print "Reached bottom limit"
elseif event.direction == "left" then
print "Reached left limit"
elseif event.direction == "right" then
print "Reached right limit"
end
end
return true
end
scrollView = widget.newScrollView
{
top = 200,
left = 250,
width = 500,
height = 400,
scrollWidth = 500,
scrollHeight = 10,
topPadding = 0,
bottomPadding = 0,
leftPadding = 0,
rightPadding = 0,
friction = .972 , -- how fast the scroll view moves. default is .972
hideBackground = true, -- if true it wont show the background color.
horizontalScrollDisabled = true,
verticalScrollDisabled = false,
listener = scrollListener,
}
代碼太多。請刪除所有不直接相關的代碼(刪除代碼後不會刪除問題的代碼)。 – Schollii
我已經刪除了不相關的其他代碼行。請立即檢查。 –
確定這是好多了,但你刪除了一些太多:)以上是不足以重現該問題:您需要添加內容到視圖。我在我的回答中假設你如何做到這一點。 – Schollii