【问题标题】:Corona SDK: storyboard.gotoScene with effectCorona SDK:storyboard.gotoScene 效果
【发布时间】:2013-07-04 19:16:09
【问题描述】:

在我的菜单故事板和名为“搜索”的故事板之间转换时,我尝试使用效果 slideLeft。

scenechange 有效,但没有应用到过渡效果。或者..根本没有过渡。新场景刚刚出现。

我在这里错过了什么?

谢谢。

local function goToPage(event)
if (event.phase == "ended") then
    changeButtonIndentation()
    local nextSceneName = "pages." .. event.target.name
    if (storyboard.getCurrentSceneName() ~= nextSceneName) then
        print("From page: " .. storyboard.getCurrentSceneName())
        print("To page: " ..nextSceneName)

        local options =
        {
            effect = "slideLeft",
            time = 1000
        }
        storyboard.gotoScene("pages.search", options)
        currentActivePage = event.target.name
        print(event.target.name)
    end
end
changeButtonIndentation()
end

编辑:看来 options 有效。如果我增加 optionstime 参数,我会注意到 search storyboard 上的某些按钮在 1 秒内无法点击。但是效果不起作用。

【问题讨论】:

    标签: ios lua coronasdk


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      如果不是构建错误,请先尝试测试。 转到帮助 -> 示例项目并打开 Storyboard 示例。如果您看到转换,则问题出在您的代码中。

      所以试试这个简化的代码:

      local function goToPage(event)
          if (event.phase == "ended") then
              local options =
              {
                  effect = "slideLeft",
                  time = 1000
              }
              storyboard.gotoScene("pages.search", options)
          end
          return true
      end
      

      【讨论】:

        【解决方案3】:

        没有过渡的主要原因是如果您在 enterScene() 函数而不是 createScene() 函数中创建场景。

        【讨论】:

          猜你喜欢
          • 2014-01-31
          • 1970-01-01
          • 2023-03-30
          • 1970-01-01
          • 1970-01-01
          • 2015-05-18
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多