Hey
I am using the tabBar controller available in viewController.lua (https://bitbucket.org/gilbert/view-controller-library).
It is working just great on any device and I am very pleased I have found this library for use in all utility apps we make.
BUT... I need to reload the tabbars in some way. There are initialized in main.lua like below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | local function init() --Create a group that contains the entire screen and tab bar mainView = display.newGroup() --Create a group that contains the screens beneath the tab bar tabView = display.newGroup() mainView:insert(tabView) if (not userID) then print ("user is 0") local path = system.pathForFile( "user.txt", system.DocumentsDirectory ) -- io.open opens a file at path. returns nil if no file found local fh = io.open( path, "r" ) if fh then -- read all contents of file into a string userID = fh:read( "*a" ) --native.showAlert("test",userID,{"ja"},onComplete) fh:close() else local fw = io.open( path, "w" ) -- open/create for write fw:write("0") fw:close() end createTabs() else print ("user is not 0") createTabs() end return true end function createTabs() if (userID == "0") then tabBar = viewController.newTabBar{ background = "gfx/tabBar.png", --tab bar background tabs = {"Hem", "Regler"}, --names to appear under each tab icon onRelease = showScreen --function to execute when pressed } mainView:insert(tabBar) loadScreen("screen1") tabBar.selected() else tabBar = viewController.newTabBar{ background = "gfx/tabBar.png", --tab bar background tabs = {"Hem", "Regler", "Rapportera", "Topplista"}, --names to appear under each tab icon onRelease = showScreen --function to execute when pressed } mainView:insert(tabBar) print ("tabbar loaded") print ("user id " .. "" .. "is present so load screen 3 and set that as active tab") loadScreen("screen3") tabBar.selected() end end |