I am not sure if this is one of the intended function but when I try to setSelected for tabbar into a 0 or nil, I was hoping that it will unselect everything in the tab. However, all label color change back to default value except for the selected background. Example code:
--Example from Corona Doc: https://docs.coronalabs.com/api/library/widget/newTabBar.html local widget = require( "widget" ) local function handleTabBarEvent( event ) print( event.target.id ) end local options = { frames = { { x=4, y=0, width=24, height=120 }, { x=32, y=0, width=40, height=120 }, { x=72, y=0, width=40, height=120 }, { x=112, y=0, width=40, height=120 }, { x=152, y=0, width=72, height=120 }, { x=224, y=0, width=72, height=120 } }, sheetContentWidth = 296, sheetContentHeight = 120 } local tabBarSheet = graphics.newImageSheet( "widget-tabbar-sheet.png", options ) -- Configure the tab buttons to appear within the bar local tabButtons = { { defaultFrame = 5, overFrame = 6, label = "Tab1", id = "tab1", selected = true, size = 16, labelYOffset = -8, labelColor = { default={ 1 }, over={ 0 } }, onPress = handleTabBarEvent }, { defaultFrame = 5, overFrame = 6, label = "Tab2", id = "tab2", size = 16, labelYOffset = -8, labelColor = { default={ 1 }, over={ 0 } }, onPress = handleTabBarEvent }, { defaultFrame = 5, overFrame = 6, label = "Tab3", id = "tab3", size = 16, labelYOffset = -8, labelColor = { default={ 1 }, over={ 0 } }, onPress = handleTabBarEvent } } local tabBar = widget.newTabBar( { sheet = tabBarSheet, left = 0, top = display.contentHeight-120, width = 580, height = 120, backgroundFrame = 1, tabSelectedLeftFrame = 2, tabSelectedMiddleFrame = 3, tabSelectedRightFrame = 4, tabSelectedFrameWidth = 40, tabSelectedFrameHeight = 120, buttons = tabButtons } ) --When I run this line, all label changed back to default color except for tabSelected background image that still remains tabBar:setSelected( 0 ) --or tabBar:setSelected( nil )
I would like to know if this is actually not the intended function or it is really a bug with the background?
I am using Corona Build: 2016.2906