Positioning Problem of the assets in apps

I am using letterbox scaling in config.lua and set the

width = 1080,

height = 1920, 

scale = “letterbox”,  

fps = 30, 

app is working fine in most of devices but in ipad,

It is showing some black area at the top of device.

How to solve this problem?

Hi @puneetpositive,

When working with letterbox (my personal preference in most apps), you need to handle the “letterbox” regions yourself.

  1. For background material (fills, etc.), you can usually just make the background fill/object larger and let it run off the edges on all screens.

  2. For UI elements that must align to an edge of any screen, you need to push these objects up against the screen edge. I use the following code to check for and adjust object based on any screen:

[lua]

local ox = (display.actualContentWidth-display.contentWidth)/2

local oy = (display.actualContentHeight-display.contentHeight)/2

[/lua]

These values give you the width or height of the letterbox bars on any device, and you can add or subtract them from the position of any object to tuck it up against the appropriate screen edge.

If you don’t want to deal with letterbox stuff, you can use the “zoomEven” scale mode, but then, some things will flow off (bleed off) the screen on some devices, so you’ll need to make adjustments for that.

http://docs.coronalabs.com/guide/basics/configSettings/index.html

Brent

Hi @puneetpositive,

When working with letterbox (my personal preference in most apps), you need to handle the “letterbox” regions yourself.

  1. For background material (fills, etc.), you can usually just make the background fill/object larger and let it run off the edges on all screens.

  2. For UI elements that must align to an edge of any screen, you need to push these objects up against the screen edge. I use the following code to check for and adjust object based on any screen:

[lua]

local ox = (display.actualContentWidth-display.contentWidth)/2

local oy = (display.actualContentHeight-display.contentHeight)/2

[/lua]

These values give you the width or height of the letterbox bars on any device, and you can add or subtract them from the position of any object to tuck it up against the appropriate screen edge.

If you don’t want to deal with letterbox stuff, you can use the “zoomEven” scale mode, but then, some things will flow off (bleed off) the screen on some devices, so you’ll need to make adjustments for that.

http://docs.coronalabs.com/guide/basics/configSettings/index.html

Brent