在Corona Sdk中,我在scrollView中有一个按钮。触摸按钮时无法滚动滚动视图。我怎么能这样做?
代码位于以下代码段中:
local scrollView = require("scrollView")
local background = display.newRect(0, 0, display.contentWidth, display.contentHeight)
background:setFillColor(100, 100, 100)
local topBoundary = display.screenOriginY
local bottomBoundary = display.screenOriginY
local scrollView = scrollView.new{ top=topBoundary, bottom=bottomBoundary }
local contentGroup = display.newGroup()
local bg = display.newImage("bg.png")
bg:setReferencePoint(display.TopLeftReferencePoint)
contentGroup:insert(bg)
bg.x,bg.y = 0,0
local button = ui.newButton{
default = "buttonBlue.png",
over = "buttonBlueOver.png",
text = "Button 1 Label",
emboss = true
}
button.x, button.y = 50, 100
contentGroup:insert(button)
scrollView:insert(contentGroup)
谢谢!
答案 0 :(得分:1)
您是否考虑在视图顶部放置一个隐藏图层来拦截触摸,确保它返回" true"?
使其成为按钮事件侦听器在按下时生成此图层。
只是一个想法。祝你好运。 :)
-MB