vitaliy-zh
vitaliy-zh

Reputation: 205

Full iPhone X resolution in Firemonkey app?

If i try to run an simple iOS app (written in 10.1 Berlin ) on iPhone X, the app can’t use a full iPhone X display size. It is possible to set a full iPhone X resolution for an Delphi/FMX app?

Upvotes: 1

Views: 1406

Answers (1)

Dave Nottage
Dave Nottage

Reputation: 3602

You need to include the additional 2 launch images required for iPhone X as per this chart:

https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/launch-screen/

Also, you'll need to provide a custom .info.plist, which includes entries for the launch images (since the IDE does not do it for you), i.e. add this to the array node for the UILaunchImages key:

        <dict>
            <key>UILaunchImageSize</key>
            <string>{375, 812}</string>
            <key>UILaunchImageName</key>
            <string>Default-812h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>8.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Portrait</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{812, 375}</string>
            <key>UILaunchImageName</key>
            <string>Default-Landscape-812h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>8.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Landscape</string>
        </dict>

You'll need to add the images to the project deployment, and edit the Remote Name properties for each to align with the entries in the .info.plist, e.g:

enter image description here

But wait, there's more! You also need to account for spacing as per the other answer from Pimmie. You could do this by having layouts aligned to the top, bottom, left and right that are shown only when on iPhone X, using something like:

uses
  iOSapi.Helpers;

...

if TiOSHelper.MainScreen.bounds.size.height = 812 then
  // iPhoneX

There's also an issue with Delphi providing "space" for the status bar which it might not need to do for iPhone X (still working this out).

For me, this procedure works with both Berlin and Tokyo, however all in all: not trivial

Upvotes: 2

Related Questions