0
說我有一個單元格,這三個對象具有不同的ID,我可以識別行觸摸,但我如何識別在桌子視圖內觸摸的對象在電暈中的表視圖?如何識別在corona sdk中的桌子上碰到的物體?
這是我使用
local function onRowRender(event)
local row = event.row
local rowHeight = row.contentHeight
local rowWidth = row.contentWidth
local speaker1 = display.newImage(row,"images/listen.png",70,70)
speaker1.width = 20;speaker1.height = 20*ryx
speaker1.x = 35;speaker1.y = suby
speaker1.id = "speaker1"
local eye1 = display.newImage(row,"images/eye.png",70,70)
eye1.width = 20;eye1.height = 20*ryx
eye1.x = 60;eye1.y = suby
eye1.id = "eye1"
speaker1:addEventListener("touch",onObjectTouch)
eye1:addEventListener("touch",onObjectTouch)
end
和
local function onRowTouch(event)
local phase = event.phase
local row = event.target
touchedRowIndex = row.index
print(event.target.id)
print(event.target)
print(event.target.name)
if ("release" == phase) then
return true
end
end
我使用觸摸監聽器爲每個對象試過的代碼,沒有運氣