我有以下代码:科罗娜SDK widget.newButton()没有出现在模拟器里面的时候的场景:创建
function scene:create(event)
local sceneGroup = self.view
-- Initialize the scene here.
-- Example: add display objects to "sceneGroup", add touch listeners, etc.
local options1 = {
x = display.contentWidth/2,
y = 200,
onRelease = button,
lableAlign = "center",
emboss = true,
id = "1",
label = "Button1"
}
local options2 = {
y = 300,
x = display.contentWidth/2,
onRelease = button,
lableAlign = "center",
emboss = true,
id = "2",
label = "Button2"
}
local button1 = widget.newButton(options1)
local button2 = widget.newButton(options2)
sceneGroup:insert(button1)
sceneGroup:insert(button2)
end
当我把这个代码放在一个独立的文件(而不是场景)的按钮显示如所假设的。但是现在我将这个独立文件变成了一个场景,由于某种原因,上面的代码在模拟器中没有任何结果。有任何想法吗?
我们将需要更多代码 - 向我们展示如何转换到场景中,并且您是否在新场景中包含小部件? – 2014-09-03 11:47:18
这是我的main.lua文件。也许这是问题? – user1790813 2014-09-03 11:55:27
是的,这是问题所在。 – 2014-09-03 11:56:59