Problem with a Tab Bar (Width and height)

Hello everybody, recently i change the resolution of my app. 

I had passed of 320 x 480 at 720 x 1280.

Very good for the quality but a little problem i want that the size of my TAB BAR change also! 

but i didn’t find the solution for this ! 

i put for you my god who find the solution a screen of my code and my app. 

thank you for you reading

You need to scale your tab bar accordingly.  720 / 320 = 2.25 or something like that.  Your tabBar needs to be that much taller.  Looking at your slices I see they are 52 pix high.  So your tabBar should have a height = 117, in the setup and your images need adjusted accordingly.

Hello Rob and thank you for your post! very fastly.

Yes, i did what you said, but i have a problem in my code i have : 

local demoTabs = widget.newTabBar { top = display.contentHeight - 70, width = display.contentWidth, backgroundFile = "assets/tabbar.png", tabSelectedLeftFile = "assets/tabBar\_tabSelectedLeft.png", tabSelectedMiddleFile = "assets/tabBar\_tabSelectedMiddle.png", tabSelectedRightFile = "assets/tabBar\_tabSelectedRight.png", tabSelectedFrameWidth = 20, tabSelectedFrameHeight = 52, buttons = tabButtons }

And i want change the size just of the backgroundFile (line 5) 

the 20 and 52 is for a other componment of tabar not important.

So, i want change the Height of the BackgroundFile and i try some lines of code i tried this : 

backgroundHeight = 117

change nothing 

tried this : 

backgroundFile.height = 117 

Error. 

so i dont now really…

Please…

Hi Kevin,

Based on your code and description, I think you need to adjust the height of the core image, before you attempt to load it as part of the widget. Also, may I ask, are you creating this tab bar from an image sheet, or individual images? The syntax varies slightly depending on which method you’re using.

Best regards,

Brent

 local demoTabs = widget.newTabBar {     top = display.contentHeight - 70,     width = display.contentWidth,     height = 117,     backgroundFile = "assets/tabbar.png",     tabSelectedLeftFile = "assets/tabBar\_tabSelectedLeft.png",     tabSelectedMiddleFile = "assets/tabBar\_tabSelectedMiddle.png",     tabSelectedRightFile = "assets/tabBar\_tabSelectedRight.png",     tabSelectedFrameWidth = 20,     tabSelectedFrameHeight = 117,     buttons = tabButtons   }

You need to scale all four . png’s to where they are 117 px high.  Then adjust the FrameWidth to whatever it works out to after you resize the image to 117 px high.

Thank you very much rob and Brent.
I Will test this this Weekend.

I think thé code and corona auto ajust thé size of png without resize every png on Photoshop.

You dont belive this ?

Best regards

It uses the width and height that you pass as the parameters to load in the image.  It uses display.newImageRect() which requires these parameters.  If you don’t provide the height it defaults to the height from the theme in use or 52.  By not specifying the height, it’s loading in your background at display.contentWidth wide and 52 high.

Ok it’s work very well, but the size of the label in this code : 

 { width = 80, height = 80, defaultFile = "iconniconb.png", overFile = "iconnico.png", label = "Nico", onPress = function() storyboard.gotoScene( "view6" ); end, }, }

the label = ‘‘Nico’’, is always at the old size when my screen resolution was 320 x 480. 

so now the label on the tab bar is very small.

you have an idea?

i found ! 

i just put a 

size = ... font = ...

thank you every body

Ok everything work…

BUT! yes i have a but, the last problem! 

i looked for but i didn’t find…

In fact, i have my home and 5 other page, in the other page i have Local webview (in all page).
But with different website. 
My problem is that when i am in the second page, and i click on the third, the webview of the second page stay here and don’t let the place at webview of the third page…

I put a group:insert(webview) 

don’t work…

You probably need to remove the old webView so your new one can be created.

Yes its m’y problem i didnt find how i CAN remove my webview

whateverYouCalledYourWebview:removeSelf()

When i put in my code :

Webview:removeself()

In my àndroid device, thé webview dont work.
It dont work only When i put webview:removeself()

Can you post the code where you’re creating your webview and where you’re removing it?  Make sure to enclose it in [code] and [/code] tags please.

it’s the code of my view 2 which include a webview : 

-- -- Project: main.lua -- Description: -- -- Version: 1.0 -- Managed with http://CoronaProjectManager.com -- -- Copyright 2013 . All Rights Reserved. -- ----------------------------------------------------------------------------------------- -- -- view2.lua -- ----------------------------------------------------------------------------------------- local storyboard = require( "storyboard" ) local scene = storyboard.newScene() ----------------------------------------------------------------------------------------- -- BEGINNING OF YOUR IMPLEMENTATION -- -- NOTE: Code outside of listener functions (below) will only be executed once, -- unless storyboard.removeScene() is called. -- ----------------------------------------------------------------------------------------- local webView = native.newWebView( 0, 0, 720, 1080 ) webView:request( "https://www.facebook.com/pages/Mika-Pronos/172776792874547?fref=ts" ) -- Called when the scene's view does not exist: function scene:createScene( event ) local group = self.view group:insert(webView) end -- Called immediately after scene has moved onscreen: function scene:enterScene( event ) local group = self.view -- Do nothing end -- Called when scene is about to move offscreen: function scene:exitScene( event ) local group = self.view -- INSERT code here (e.g. stop timers, remove listenets, unload sounds, etc.) end -- If scene's view is removed, scene:destroyScene() will be called just prior to: function scene:destroyScene( event ) local group = self.view -- INSERT code here (e.g. remove listeners, remove widgets, save state variables, etc.) end ----------------------------------------------------------------------------------------- -- END OF YOUR IMPLEMENTATION ----------------------------------------------------------------------------------------- -- "createScene" event is dispatched if scene's view does not exist scene:addEventListener( "createScene", scene ) -- "enterScene" event is dispatched whenever scene transition has finished scene:addEventListener( "enterScene", scene ) -- "exitScene" event is dispatched whenever before next scene's transition begins scene:addEventListener( "exitScene", scene ) -- "destroyScene" event is dispatched before view is unloaded, which can be -- automatically unloaded in low memory situations, or explicitly via a call to -- storyboard.purgeScene() or storyboard.removeScene(). scene:addEventListener( "destroyScene", scene ) ----------------------------------------------------------------------------------------- webview:removeSelf() return scene

i’m not sure of the : group:insert(webview) and of webview:removeSelf

Here’s some food for thought.  First, you are creating the webView is the scene’s main chunk.  That will execute only once, ever, unless you call storyboard.removeScene() on the scene.   Secondly, native objects, like native.newWebView() are not able to interact with Corona display objects.  That means that you cannot put a native.newWebView() into a group, i.e. group:insert(webView) does nothing.

Because Storyboard works on OpenGL based display objects, Storyboard cannot manage native.* objects.  You’re best way to do this is to  move these two lines:

local webView = native.newWebView( 0, 0, 720, 1080 )
webView:request( “https://www.facebook.com/pages/Mika-Pronos/172776792874547?fref=ts” )

inside the enterScene() function.  You need to take the “local” off.  Where those two lines of code exist now, just leave:

local webView

This will create a forward declaration for the object so you can access it in multiple functions.  Then in your exitScene() function do:

if webView and webView.removeSelf() then

     webView:removeSelf()

     webView = nil

end

See if that helps you.

I change my code like you said to me.
I have the same error, the last page stay when i change of page : 

-- -- Project: main.lua -- Description: -- -- Version: 1.0 -- Managed with http://CoronaProjectManager.com -- -- Copyright 2013 . All Rights Reserved. -- ----------------------------------------------------------------------------------------- -- -- view2.lua -- ----------------------------------------------------------------------------------------- local storyboard = require( "storyboard" ) local scene = storyboard.newScene() ----------------------------------------------------------------------------------------- -- BEGINNING OF YOUR IMPLEMENTATION -- -- NOTE: Code outside of listener functions (below) will only be executed once, -- unless storyboard.removeScene() is called. -- local webView -- Called when the scene's view does not exist: function scene:createScene( event ) local group = self.view end -- Called immediately after scene has moved onscreen: function scene:enterScene( event ) local group = self.view local webView = native.newWebView( 0, 0, 720, 1080 ) webView:request( "https://www.facebook.com/pages/Mika-Pronos/172776792874547?fref=ts" ) -- Do nothing end -- Called when scene is about to move offscreen: function scene:exitScene( event ) local group = self.view if webView and webView.removeSelf() then webView:removeSelf() webView = nil end -- INSERT code here (e.g. stop timers, remove listenets, unload sounds, etc.) end -- If scene's view is removed, scene:destroyScene() will be called just prior to: function scene:destroyScene( event ) local group = self.view -- INSERT code here (e.g. remove listeners, remove widgets, save state variables, etc.) end ----------------------------------------------------------------------------------------- -- END OF YOUR IMPLEMENTATION ----------------------------------------------------------------------------------------- -- "createScene" event is dispatched if scene's view does not exist scene:addEventListener( "createScene", scene ) -- "enterScene" event is dispatched whenever scene transition has finished scene:addEventListener( "enterScene", scene ) -- "exitScene" event is dispatched whenever before next scene's transition begins scene:addEventListener( "exitScene", scene ) -- "destroyScene" event is dispatched before view is unloaded, which can be -- automatically unloaded in low memory situations, or explicitly via a call to -- storyboard.purgeScene() or storyboard.removeScene(). scene:addEventListener( "destroyScene", scene ) ----------------------------------------------------------------------------------------- return scene

try changing this

if webView and webView.removeSelf() then

to:

if webView and webView.removeSelf then

(take the parens off)