Livecode Wiki
Advertisement

Some apple product have an high resolution display, usually called retina. This displays have 2 resolution: norma and high. If you want to use the high resolution, you need to activate it with iphoneUseDeviceResolution command.

Syntax:

iphoneUseDeviceResolution { true | false }, [true | false]

Examples:

iphoneUseDeviceResolution true
iphoneUseDeviceResolution true, true
iphoneUseDeviceResolution true, false
iphoneUseDeviceResolution false

The iPhone 4 has a display with double the resolution in both horizontal and vertical directions. By default, iOS handles this by mapping one logical 'point' to two physical 'pixels' with applications (LiveCode included) interpreting everything in terms of logical points. This means that apps targetted for older devices can run identically on the newer iPhone 4 devices.

If the iphoneUseDeviceResolution command is passed true as the first argument, LiveCode ensures that co-ordinates and sizes specified in LiveCode are treated as being in pixels, rather than logical points. In particular, when changed, a resizeStack message is sent notifying the size change of the current main-stack, and functions and properties (such as the screenRect) reflects co-ordinates in pixels.

If the iphoneUseDeviceResolution command is passed true as the second argument, LiveCode ensures that co-ordinates and sizes specified in LiveCode for custom controls are treated as being in pixels, rather than logical points.

The notion of pixel and logical point remains valid on older devices, it is just that it is always 1-1 thus using this command has no effect there. The scale of the device's screen (relative to a non-Retina display) can be queried using iphoneDeviceScale function. This function returns 2 if the display is a Retina display, or 1 otherwise.


Clarifications[]

This is a simple app not scaled:

Retina1

Not scaled app (click to see details)

If I normally scale on a retina display:

Retina2

Bad scaled app (click for details)

If use the code:

iphoneUseDeviceResolution true

and then I scale, I get:

Retina3

Good scaled on retina display (click for details)

Advertisement