Sdk Corona storyboard.gotoScene选项不工作

Sdk Corona storyboard.gotoScene选项不工作,sdk,storyboard,transition,coronasdk,options,Sdk,Storyboard,Transition,Coronasdk,Options,我在Corona中使用了一行简单的代码来实现场景之间的转换——转换发生了,但效果却没有 storyboard.gotoScene( "splash", "fade", 2000 ) 我已经编译了Xcode模拟器的构建,以查看淡入淡出效果是否可以在那里工作,但它不能 storyboard.gotoScene( "splash", "fade", 2000 ) 完整代码- local storyboard = require "storyboard" local scene = st

我在Corona中使用了一行简单的代码来实现场景之间的转换——转换发生了,但效果却没有

storyboard.gotoScene( "splash", "fade", 2000 )
我已经编译了Xcode模拟器的构建,以查看淡入淡出效果是否可以在那里工作,但它不能

storyboard.gotoScene( "splash", "fade", 2000 )
完整代码-

     local storyboard = require "storyboard"
 local scene = storyboard.newScene()

 local SplashGroup = display.newGroup()

 local function onBackgroundTouch()
     storyboard.gotoScene("mainmenu", "fade", 2000)
 end

 --Called if the scene hasn't been previously seen

function scene:createScene (event)
     local logoImage = display.newImage("RoxisLogo.png")
     logoImage.x = display.contentWidth/2
     logoImage.x = display.contentHeight/2
     SplashGroup:insert(logoImage)
     logoImage:addEventListener("tap", onBackgroundTouch)
 end

 function scene:enterScene(event)
     SplashGroup.alpha=1
     end

 function scene:exitScene(event)
     SplashGroup.alpha=0
end

--"createScene" is called whenever the scene is FIRST called
scene:addEventListener("createScene", scene)

 --"enterScene event is dispatched whenever scene transition has finished
 scene:addEventListener("enterScene", scene)

 --"exitScene" event is dispatched before the next scene's transition begins
 scene:addEventListener("exitScene", scene)

return scene

我看不到您在哪里向场景视图添加任何内容。通常在CreateSecene和Entersecene的开头有这样一行:

group = scene.view
该组是一个显示组,如果希望情节提要打开或关闭场景,则必须将每个显示对象插入该组。您正在创建自己的名为localGroup的组,这很好,但该组需要放入“组”中

另外,您在CreateSecene()中所做的事情发生在屏幕外,然后在屏幕上转换。如果在enterScene中创建显示对象,它们将弹出到视图中

最后,在enterScene中设置alpha并将其隐藏在exitScene中。这也会扼杀任何转换。我会在CreateSecene()和Entersecene()函数中释放那些alpha设置,并添加那些“group=scene.view”行,然后将对象添加到该组中。

请使用-

本地组=self.view并添加
组:在创建场景对象后插入(场景)


希望它能帮助您。

一个常见的错误是您忘记将视图元素添加到self.view组。通常,故事板模板在
scene:createScene
函数的开头包含
local group=self.view
。尝试将视图对象插入该组。然后重试您的转换