在我menu.lua我有以下代碼:storyboard.gotoScene("vegScreen")
,意思是:蔬菜屏幕/菜單電暈的TabBar創建失敗
在場景:我vegScreen.lua的createScene函數我試圖創建2個選項卡一個的TabBar 。使用下面的代碼:
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)
使用這個代碼,我得到以下錯誤:
http://i.imgur.com/0koV4PK.png
82號線在vegScreen.lua是我創建新的TabBar(productBar = widget.newTabBar)
雖然我不知道我創建的圖像是否正確使用,但它應該顯示我正確的東西?我在我的vegScreen.lua文件(用於故事板和小工具)的頂部有模塊require語句,創建了與vegScreen.lua位於同一文件夾中的catagory.lua和all.lua文件,並且我已經定義了該組變量。有人能幫我嗎?這個錯誤對我沒有任何意義。
你能像第82行那樣標記vegscreen.lua的第37行;也比「使用此代碼」更具體,您是否在第一次創建場景時立即看到此回溯? – Schollii 2014-09-28 04:19:31
第37行是場景:createScene函數,其中放置了上面的代碼。我目前通過從我的場景中移除storyboard.purgeScene(storyboard.getCurrentSceneName())來解決問題:exitScene函數。但是,然後一個全新的......錯誤風暴在我身上滾下來 – Tomjesch 2014-10-01 17:35:00