I have an app and when the user signs in there is a tab bar at the bottom (like Instagram) . There are two tabs at the bottom , newsfeed and profile . When i’m on newsfeed the text color is blue which means I’m on the page . But when I click profile , it looks like i’m still on newsfeed . How do I fix it up so that when I click newsfeed and profile it’s a link to a different page ?
This is what I have so far :
userarea.lua :
local composer = require( "composer" ) local scene = composer.newScene() local widget = require("widget") -- forward declare the text fields local json = require("json") local username local pw local function networkListener( event ) if ( event.isError ) then local alert = native.showAlert( "Error Loading .", "Check your internet connection .", { "Try again" } ) end end function scene:create(event) local screenGroup = self.view local background = display.newImageRect("background.jpg",display.contentWidth,display.contentHeight) background.x = display.contentCenterX background.y = display.contentCenterY screenGroup:insert(background) end local tabButtons = { { label = "#NewsFeed", width = 52, height = 10, id = "newsfeed", size = 16, selected = true, onPress = handleTabBarEvent }, { label = "#Profile", size = 16, id = "profile", onPress = handleTabBarEvent } } -- Create the widget local tabBar = widget.newTabBar( { top = display.contentHeight -60, width = display.contentWidth, buttons = tabButtons, } ) function scene:show(event) local phase = event.phase if ( phase == "will" ) then print("Phase started") elseif ( phase == "did" ) then print("phase on login") end composer.removeScene( "login" ) end scene:addEventListener( "show" ) function scene:hide(event) end function scene:destroy(event) end scene:addEventListener("create", scene) scene:addEventListener("show", scene) scene:addEventListener("hide", scene) scene:addEventListener("destroy", scene) return scene
Also how do I set a background color or image for my tab bar ?