Hello,
I am using the library
https://github.com/worldstar/GridView-for-Corona-SDK
but can not make the scroll view works perfectly vertical.
I can only scroll the screen if I pull on the edge of images, when I try to scroll the page by pulling on the image nothing happens.
Could anyone help me?
local widget = require("widget") local scrollView = nil local gridView = {} function gridView:new(gridX, gridY, photoArray, photoTextArray, columnNumber, paddingX, paddingY, photoWidth, photoHeight, gridListener) local currentX = gridX local currentY = gridY function onStarButtonRelease(event) local btId = event.target.id local index = 0 -- print(btId) for i = 1, #photoArray do if(btId == "grid"..i) then index = i break end end gridListener(index) end function drawGrid() scrollView = widget.newScrollView{ left = 0, top = 0, width = \_W, height = \_H, horizontalScrollDisabled = true, verticalScrollDisabled = false, isBounceEnabled = true, } for i = 1, #photoArray do local fontSize = 36 gridView.gridObject = widget.newButton{ id = "grid"..i, defaultFile = photoArray[i], --For Widget V2.0, change the default to defaultFile left = currentX, top = currentY, width = photoWidth, height = photoHeight, onRelease = onStarButtonRelease } scrollView:insert(gridView.gridObject) --[[local r = 0 gridView.roundedRect = display.newRoundedRect( currentX, currentY + 35, photoWidth, 70, r ) gridView.roundedRect:setFillColor( 1, 1, 1 ) gridView.roundedRect.alpha = 0.4 gridView.roundedRect.anchorX = 0 scrollView:insert(gridView.roundedRect) --Limit the label length --Determine the longest length of the label string local bestStringLength = photoWidth / (fontSize/2) - 1 if(string.len(photoTextArray[i]) \> bestStringLength) then photoTextArray[i] = string.sub( photoTextArray[i], 0, bestStringLength) end local textPosX = photoWidth/2 - (fontSize/2)\*string.len(photoTextArray[i])/2 gridView.textObject = display.newText( photoTextArray[i], currentX + textPosX, currentY + 33, native.systemFontBold, fontSize ) gridView.textObject:setTextColor( 255,0,0 ) gridView.textObject.anchorX = 0 scrollView:insert(gridView.textObject)]]-- --Update the position of the next item currentX = currentX + photoWidth + paddingX if(i % columnNumber == 0) then currentX = gridX currentY = currentY + photoHeight + paddingY end end end drawGrid() end return gridView