Tab bar @2 and @4 stuff?

So I was reading through the tabBar widget docs and it states that:

TabBar’s do not support Scaling nor changing it’s width/height via .width/.height.”

So does this mean the stuff I set up in the config.lua:

                ["@2x"] = 1.5,

                ["@4x"] = 3.0,

has no effect then?

Must I detect the device I’m on and manually set the width and height of the icons (as well as the graphics I’m loading in)? Like for iPhone 5 I’d load higher resolution assets as well as setting the width and height?

Appreciate any help!!

Best,

Mario

No,

It just means you can’t scale a tab bar via object:scale() or object.xScale etc nor change it’s width after creation via object.width/height

Ah, sorry that’s the tabBar part, but for the button image loading:

[lua]

– Create the tabBar’s buttons

local tabButtons = 

{

    {

        width = 32, 

        height = 32,

        defaultFile = “assets/tabIcon.png”,

        overFile = “assets/tabIcon-down.png”,

        label = “Tab1”,

        labelColor =

        {

            default = { 0, 0, 0 },

            over = { 255, 255, 255 },

        },

        font = native.systemFontBold,

        size = 8,

        onPress = function() print( “Tab 1 pressed” ) end,

        selected = false

    },

[/lua]

where I’m required to set the width and height manually, doesn’t that nullify the automagic loading of the higher resolution assets for my tab buttons?

Sorry, I’ve always “rolled my own” tab bar, this is my first crack at using Corona’s native version. :slight_smile:

Appreciate the help!

-Mario

No, setting the image width / height there enables the use of dynamic asset loading. 

This: ““TabBar’s do not support Scaling nor changing it’s width/height via .width/.height.”” is talking about the tab bar object, settings its .width, .height, .xScale etc *after* creation. You are doing everything correctly from what I can see :slight_smile:

Thanks Danny!! Remember you said that when I head back here to start whining!! :wink:

I’ll give it a go and see what happens!

-Mario

No,

It just means you can’t scale a tab bar via object:scale() or object.xScale etc nor change it’s width after creation via object.width/height

Ah, sorry that’s the tabBar part, but for the button image loading:

[lua]

– Create the tabBar’s buttons

local tabButtons = 

{

    {

        width = 32, 

        height = 32,

        defaultFile = “assets/tabIcon.png”,

        overFile = “assets/tabIcon-down.png”,

        label = “Tab1”,

        labelColor =

        {

            default = { 0, 0, 0 },

            over = { 255, 255, 255 },

        },

        font = native.systemFontBold,

        size = 8,

        onPress = function() print( “Tab 1 pressed” ) end,

        selected = false

    },

[/lua]

where I’m required to set the width and height manually, doesn’t that nullify the automagic loading of the higher resolution assets for my tab buttons?

Sorry, I’ve always “rolled my own” tab bar, this is my first crack at using Corona’s native version. :slight_smile:

Appreciate the help!

-Mario

No, setting the image width / height there enables the use of dynamic asset loading. 

This: ““TabBar’s do not support Scaling nor changing it’s width/height via .width/.height.”” is talking about the tab bar object, settings its .width, .height, .xScale etc *after* creation. You are doing everything correctly from what I can see :slight_smile:

Thanks Danny!! Remember you said that when I head back here to start whining!! :wink:

I’ll give it a go and see what happens!

-Mario