我在让屏幕过渡效果发挥作用方面遇到了问题。我尝试过支持的渐变和交叉渐变效果,但当过渡发生时,它是即时的,根本没有渐变效果。其他一切都很好,我没有任何错误。我做错了什么?
local storyboard = require ("storyboard")
local scene = storyboard.newScene()
local loading = require ("loading")
local loading = loading.new()
function switch()
storyboard.gotoScene("scene1","fade", 700)
end
function scene:enterScene( event )
timer.performWithDelay(2000,switch,1)
end
scene:addEventListener( "enterScene", scene )
return scene
我也试过
function switch()
storyboard.gotoScene("scene1",{effect="fade", time=700})
end
和
local options = {effect="fade", time=700}
function switch()
storyboard.gotoScene("scene1", options)
end
一个常见的错误是忘记将视图元素添加到self.view组中。通常,故事板模板在场景的开头包含localgroup=self.view:createScene函数。尝试将视图对象插入到该组中。然后重试转换。