display.actualContentHeight in ipadMini and ipadAir Problem

I had a problem where display.actualContentHeight is not working properly in ipadMini and ipadAir where it appears to be much smaller than its real actualHeight therefore bleeding most of the content at the top using display.actualContentHeight for thier positioning. How can I solve this?

It would of course be helpful to see your config.lua, but it’s most likely you’re using a content area that is defined as 320x480 (the standard we use). But your iPad Air has a screen the size of 1536 x 2048, way bigger than 320x480.  Before I get to your answer, there is another concept you have to understand.

Screens come in different shapes.  The defined content area of 320x480 is known as a 3:2 aspect ratio (or 1.5:1). The easy way is to think of it as a 4x6 photo.  An iPad is a 4:3 device, the same as an old “standard def” TV. Aspect ratios are generally written out in such a way it makes the screen/photo horizontal/Landscape instead of vertical/portrait.  Corona SDK’s config.lua is always written in a way it assumes the screen is vertical/portrait!!!  Anyway, back to my point, if you take an 8x10 photo, turn it sideways and imagine shrinking it down to the same size as the 4x6 print, you would have a 4x5 point (5:4 aspect ratio). Some of the 4x6 photo would stick out underneath the 4x5 photo.

This is going to be exactly how Corona behaves. If you define your content area as 320 wide and 480 tall, the iPad screen when scaled to make it virtually 320 points wide (we use points not pixels since they are not 1 to 1 with pixels.!!), your “content” height of your screen will be 320/1536 * 2048 or 426.66666 points.  Therefore I would expect that:

display.contentHeight = 480

display.actualContentHeight = 426.6666

This should be the case for both versions of an iPad. But if you move this to an iPhone 5 or later, they have an aspect ration of 16:9 (or 1.7777778:1) so you will get the results:

display.contentHeight = 480

display.actualContentHeight = 568

These have nothing to do with pixel size of the screen, they are purely measures of your screen’s available screen points scaled to your defined content area.

If you need actual pixels, then you want:  display.pixelHeight and display.pixelWidth.

Are you trying to make a game or a business/utility type app?

Hope this helps you understand.

Rob

Sorry for causing a fuzz, I look back at my coding and found out that I had been ignoring the display.screenOriginX and display.screenOriginY which causes the bleeding effect.

It would of course be helpful to see your config.lua, but it’s most likely you’re using a content area that is defined as 320x480 (the standard we use). But your iPad Air has a screen the size of 1536 x 2048, way bigger than 320x480.  Before I get to your answer, there is another concept you have to understand.

Screens come in different shapes.  The defined content area of 320x480 is known as a 3:2 aspect ratio (or 1.5:1). The easy way is to think of it as a 4x6 photo.  An iPad is a 4:3 device, the same as an old “standard def” TV. Aspect ratios are generally written out in such a way it makes the screen/photo horizontal/Landscape instead of vertical/portrait.  Corona SDK’s config.lua is always written in a way it assumes the screen is vertical/portrait!!!  Anyway, back to my point, if you take an 8x10 photo, turn it sideways and imagine shrinking it down to the same size as the 4x6 print, you would have a 4x5 point (5:4 aspect ratio). Some of the 4x6 photo would stick out underneath the 4x5 photo.

This is going to be exactly how Corona behaves. If you define your content area as 320 wide and 480 tall, the iPad screen when scaled to make it virtually 320 points wide (we use points not pixels since they are not 1 to 1 with pixels.!!), your “content” height of your screen will be 320/1536 * 2048 or 426.66666 points.  Therefore I would expect that:

display.contentHeight = 480

display.actualContentHeight = 426.6666

This should be the case for both versions of an iPad. But if you move this to an iPhone 5 or later, they have an aspect ration of 16:9 (or 1.7777778:1) so you will get the results:

display.contentHeight = 480

display.actualContentHeight = 568

These have nothing to do with pixel size of the screen, they are purely measures of your screen’s available screen points scaled to your defined content area.

If you need actual pixels, then you want:  display.pixelHeight and display.pixelWidth.

Are you trying to make a game or a business/utility type app?

Hope this helps you understand.

Rob

Sorry for causing a fuzz, I look back at my coding and found out that I had been ignoring the display.screenOriginX and display.screenOriginY which causes the bleeding effect.