Confused about pixelWidth / contentWidth

Hi guys,

I have two different apps with identical config.lua and build.settings and when I run each one and output the display.pixelWidth and the display.contentWidth on the same device (an iPad PRO) I get two different numbers??!?

One of the apps says pixelWidth = 1536, contentWidth = 768 while the other one says exactly 25% bigger pixelWidth = 2048, contentWidth = 768.

Here is the config.lua (same for both apps):

application = { content = { scale = "adaptive",         fps = 60, imageSuffix = {          ["@2x"] = 1.5,          ["@4x"] = 3         }, }, notification =      {         iphone =         {             types = { "badge", "sound", "alert" }         }     }, }

It’s causing major problems - when I declare an item as 800 wide it’s correct (1:1) in one app, but there’s dynamic scaling going on in the other.

Thanks,

Nathan.

Also worth noting that this doesn’t happen in the simulator - only on the device (tried on iPhone 6S and iPad PRO).

That’s weird. If you’re running identical config.lua’s build.settings and have all the icons/launch images, you should see the same behavior.

Now there was chatter in a post yesterday about Corona not recognizing the iPad Pro’s full resolution because Apple requires a .xcasset file to be included.

We have an older tutorial on doing that:  https://coronalabs.com/blog/2014/10/21/tutorial-building-multi-screen-launch-images-using-xcode-6/

I’m 100% certain that the process has changed with Xcode 7 and now 8 but the principle is the same. There should be plenty of info on a Google search that you would work through the tutorial using modern techniques.  But  that doesn’t explain why one app behaves one way and another differently.

Rob

Ooh - hadn’t thought of launch images impacting on resolution - I bet that’s why I’m seeing a difference… will do some more research and report back.

So removing Default-Portrait-1366@2x.png (2048 x 2732) resolve the problem for the iPad PRO - it’s now showing it’s width as 1536 like the other app, and all is behaving well (no dynamic scaling going on).

I went through the tutorial and made the special UILaunchStoryboardName file and it became a problem again - pushed the iPad back into 2048 wide mode, which results in scaling in Corona even though I’m in adaptive scaling mode (I can see this as I have 1 pixel width horizontal lines in a TableView and they change size between 1 pix, 2 pix and 0 pixels in different parts of the screen when things are being dynamically scaled).

So my workaround for the iPad is to drop it’s default splash screen, which I’ve done.

The problem is other devices - e.g. the iPhone 6 is still having problems. I dropped it’s default splash (Default-667h@2x.png) and it went to a lower resolution (640 x 1136), but there is still dynamic scaling going on. I’m going to write this up on my other ticket related this this: https://forums.coronalabs.com/topic/61654-tableview-line-width/

Also worth noting that this doesn’t happen in the simulator - only on the device (tried on iPhone 6S and iPad PRO).

That’s weird. If you’re running identical config.lua’s build.settings and have all the icons/launch images, you should see the same behavior.

Now there was chatter in a post yesterday about Corona not recognizing the iPad Pro’s full resolution because Apple requires a .xcasset file to be included.

We have an older tutorial on doing that:  https://coronalabs.com/blog/2014/10/21/tutorial-building-multi-screen-launch-images-using-xcode-6/

I’m 100% certain that the process has changed with Xcode 7 and now 8 but the principle is the same. There should be plenty of info on a Google search that you would work through the tutorial using modern techniques.  But  that doesn’t explain why one app behaves one way and another differently.

Rob

Ooh - hadn’t thought of launch images impacting on resolution - I bet that’s why I’m seeing a difference… will do some more research and report back.

So removing Default-Portrait-1366@2x.png (2048 x 2732) resolve the problem for the iPad PRO - it’s now showing it’s width as 1536 like the other app, and all is behaving well (no dynamic scaling going on).

I went through the tutorial and made the special UILaunchStoryboardName file and it became a problem again - pushed the iPad back into 2048 wide mode, which results in scaling in Corona even though I’m in adaptive scaling mode (I can see this as I have 1 pixel width horizontal lines in a TableView and they change size between 1 pix, 2 pix and 0 pixels in different parts of the screen when things are being dynamically scaled).

So my workaround for the iPad is to drop it’s default splash screen, which I’ve done.

The problem is other devices - e.g. the iPhone 6 is still having problems. I dropped it’s default splash (Default-667h@2x.png) and it went to a lower resolution (640 x 1136), but there is still dynamic scaling going on. I’m going to write this up on my other ticket related this this: https://forums.coronalabs.com/topic/61654-tableview-line-width/