Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Lua Corona选项卡栏创建失败_Lua_Coronasdk_Tabbar_Corona Storyboard - Fatal编程技术网

Lua Corona选项卡栏创建失败

Lua Corona选项卡栏创建失败,lua,coronasdk,tabbar,corona-storyboard,Lua,Coronasdk,Tabbar,Corona Storyboard,在my menu.lua中,我有以下代码:storyboard.gotoScene vegScreen,意思是:蔬菜屏幕/菜单 在myvegscreen.lua的scene:createScene函数中,我尝试创建一个包含两个选项卡的选项卡栏。使用以下代码: local tabButtons = { { width = 50, height = 40, defaultFile = "assets/tabIcon.png", overFile

在my menu.lua中,我有以下代码:storyboard.gotoScene vegScreen,意思是:蔬菜屏幕/菜单

在myvegscreen.lua的scene:createScene函数中,我尝试创建一个包含两个选项卡的选项卡栏。使用以下代码:

local tabButtons = {
    {
        width = 50, height = 40,
        defaultFile = "assets/tabIcon.png",
        overFile = "assets/tabIcon-down.png",
        label = "Per catagory",
        onPress = function() storyboard.gotoScene( "catagory" ); end,
        selected = true
    },
    {
        width = 50, height = 40,
        defaultFile = "assets/tabIcon.png",
        overFile = "assets/tabIcon-down.png",
        label = "All products",
        onPress = function() storyboard.gotoScene( "all" ); end,
    }
}

productBar = widget.newTabBar{  -- line 82
    top = 65,
    width = display.contentWidth,
    backgroundFile = "assets/tabBar_background.png",
    tabSelectedLeftFile = "assets/tabBar_background.png",
    tabSelectedMiddleFile = "assets/tabBar_background.png",
    tabSelectedRightFile = "assets/tabBar_background.png",
    tabSelectedFrameWidth = 20,
    tabSelectedFrameHeight = 52,
    buttons = tabButtons
}

group:insert(productBar)
使用此代码,我得到以下错误:

vegScreen.lua中的第82行是我创建新tabBar productBar=widget.newtabar的地方


虽然我不知道我创建的图像是否正确使用,但它应该向我展示一些正确的东西?我在故事板和小部件的vegScreen.lua文件顶部有模块require语句,创建了catagory.lua和all.lua文件,它们与vegScreen.lua位于同一文件夹中,我已经定义了组变量。谁能帮帮我吗?这个错误对我来说毫无意义

这不是一个真正的答案,但我解决了我的问题。我已经创建了文件,在其中我使用代码加载内容。我认为问题在于无法向现有视图添加内容


因此,我所做的是删除这些文件,并通过代码创建视图,这很有魅力。

你能像标记第82行一样标记vegscreen.lua的第37行吗;同样比使用此代码更具体的是,您是否在第一次创建场景时就看到此回溯?第37行是scene:createScene函数,上面的代码放置在该函数中。我目前通过从我的场景:exitScene函数中删除storyboard.purgeScenestoryboard.getCurrentSceneName“解决”了这个问题。但随后,一场全新的错误风暴席卷而来