Background Image not scaling correctly in iPhone Simulator

I am facing some issues with my background image in iPhone simulator.

This is what I have in my config.lua

[lua]application =
{
content =
{
width = 768,
height = 1024,
scale = “Letterbox”
},
} [/lua]

and in my main.lua

[lua]local background = display.newImage(“images/background.png”)[/lua]

It is scaling correctly in all devices like iPad, iPhone4, android devices, etc except iPhone. It simply displays an image that takes up a quarter of the screen.

Can anyone help me? Thanks. [import]uid: 70056 topic_id: 12218 reply_id: 312218[/import]

Seems like not all android devices are fine. Basically it scales nicely only for devices with higher resolution. Any solution to this issue? [import]uid: 70056 topic_id: 12218 reply_id: 44483[/import]

You could always try changing the scale to zoomStretch

-Nick Homme [import]uid: 11769 topic_id: 12218 reply_id: 44499[/import]

Hi Nick,

I tried that as well but still the same issue.

Regards [import]uid: 70056 topic_id: 12218 reply_id: 44501[/import]

hi,

you should be using newImageRect for loading your background Image. In build.settings, use letterbox mode and set the center of the background Image to the center of the device programatically by using display.viewableContentWidth and height.

  • please let me know if this helps. [import]uid: 55009 topic_id: 12218 reply_id: 44532[/import]

Hi altafr,

It works!

Initially, I did not try out newImageRect because I thought it is only used if I have a few sets of art assets. For my case, I have only art asset for iPad.

Thank you very much. [import]uid: 70056 topic_id: 12218 reply_id: 44536[/import]