Positioning for different devices?

So far in all my Corona code the code looks different on different devices. For example, I have a button in the lower right corner to go back to the main menu on a different scene. The button is in the lower right corner on iPhone, but when I change the device to iPad, it doesn’t show (is probably cut off).

Is there a special way to make sure the display objects look the same on all devices? How would you get the button to show on the bottom right corner on all devices?

Hi @rothgerry,

A major factor in this is how you have your config.lua display area set up, which “scale” mode you’re using, etc. Have you read through this tutorial on working with a dynamic content area?

http://coronalabs.com/blog/2013/09/10/modernizing-the-config-lua/

That being said, there are a few solutions to making objects position “against a screen edge” no matter which device you’re using. My preferred method is to use “letterbox”, gather both the horizontal and vertical values for the amount of pixels between the screen edge and content area, then use those values to offset any object either left/right or up/down to ensure they remain flush against a screen edge. Other developers have different methods, but for me, the difference+offset method is the most simple and straightforward.

Hope this helps,

Brent

http://j-strahan.com/main2/_layoutlite-lua/

Ok, so you can configure this in the config.lua file? I haven’t really looked much into the config.lua file, so is this kind of stuff what it’s for?

Hi @rothgerry,

Yes, the “config.lua” file is essential to customizing many, many aspects of your app. The following guide outlines the essentials of this, so please read it over thoroughly:

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

You’ll also want to read over the guide on “build.settings”, another key file that must be included with a built project. Here’s the guide on that:

http://docs.coronalabs.com/guide/distribution/buildSettings/index.html

Take care,

Brent

Hi @rothgerry,

A major factor in this is how you have your config.lua display area set up, which “scale” mode you’re using, etc. Have you read through this tutorial on working with a dynamic content area?

http://coronalabs.com/blog/2013/09/10/modernizing-the-config-lua/

That being said, there are a few solutions to making objects position “against a screen edge” no matter which device you’re using. My preferred method is to use “letterbox”, gather both the horizontal and vertical values for the amount of pixels between the screen edge and content area, then use those values to offset any object either left/right or up/down to ensure they remain flush against a screen edge. Other developers have different methods, but for me, the difference+offset method is the most simple and straightforward.

Hope this helps,

Brent

http://j-strahan.com/main2/_layoutlite-lua/

Ok, so you can configure this in the config.lua file? I haven’t really looked much into the config.lua file, so is this kind of stuff what it’s for?

Hi @rothgerry,

Yes, the “config.lua” file is essential to customizing many, many aspects of your app. The following guide outlines the essentials of this, so please read it over thoroughly:

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

You’ll also want to read over the guide on “build.settings”, another key file that must be included with a built project. Here’s the guide on that:

http://docs.coronalabs.com/guide/distribution/buildSettings/index.html

Take care,

Brent