Keyboard height on iOS

I checked the tutorial and it’s actually still relevant for Xcode 8.

Rob

Thanks, I’ll take a look at that.

I think I was wrong above about the pixelWidth/Height being different between the stable build and latest daily.  I think actually it’s something to do with Live Builds … when I do a live build I get 640x1136 but without it I get 750x1334 …

Ahhhhhh… has it cached an old build.settings from when I first built it, maybe?  (I did restart the simulator and live server)

Anyway, I have a solution so I’m happy :slight_smile:

Changes to build.settings generally requires you to make a new live build and install it.

Rob

What do you mean by more compact? Not showing the three hints at the top?

Screen shots might help.

Rob

Hi Rob

Thanks for replying.  Screenshots below…

The first shows the keyboard in my Corona app.  The second shows the keyboard in Whatsapp (and I get the same keyboard in Facebook Messenger and other apps).  The Corona one is taller.  Which isn’t a problem really, I just wondered if there was any way to select the more compact keyboard because it leaves more space to play with above.

Tom

keyboard_corona.png

keyboard_whatsapp.png

Hi Tom:

If I’m not mistaken, you are on an iPhone 6/7 or 6 Plus/7 Plus, yes? If so then what you are seeing is the way the keyboard displays on apps that don’t explicitly support those devices’ higher resolutions, by scaling up the iPhone 5 resolution. It’s not specific to Corona: you often see it in apps that weren’t updated to support the new device resolutions back after they were introduced in 2015.

In Corona, you can solve this by including the necessary launch images in your project folder and your build.settings. Follow the guide at https://docs.coronalabs.com/guide/distribution/buildSettings/index.html#launchimage and you should be good to go.

Aha!  Right.  Many thanks for this.  Will give it a go…

Tom

Hmm, that doesn’t seem to have made any difference.  I’ve created all the launch images and added references in build.settings (literally copying that from the guide).  Keyboard still looks the same.

I’m on iPhone 6 portrait , and I’ve got a 750x1334 launch image called  Default-667h@2x.png  which is referred to in build.settings as

UILaunchImages = { { -- iPhone 6 Portrait ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-667h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{375, 667}" },

On the plus side, I’ve now got a script that generates a set of launch images from a square base 1024x1024 icon image (extending the prepare_icons.sh from Corona Cannon) which I’ll post separately in case it’s useful to anyone else :slight_smile:

Tom

You can tell if it’s working by getting values for the pixel width and pixel height and see if you’re getting 640x1136 or 750x1334. Inclusion of the file’s isn’t enough. You have to make sure the UILaunchImages table is complete. With iOS 10, you do now have to also include the landscape versions even if you’re not using them (they can point to the portrait image).

Rob

Thanks Rob.  I just realised I’m using some code in config.lua that was copied from Corona Cannon that may be causing the scaling … will read the guide and investigate further.

The iPhone 5 compatibility mode is controlled through Default.png files and build.settings. The config.lua file’s job is to map the Corona content units to the screen size. That scaling is good and wouldn’t be the cause of this.

Please print out the values of display.actualPixelHeight and display.actualPixelWidth and see if you’re getting 640x1136 or other values. If you’re on an iPhone 6 and you’re getting 640x1136 you’re still in compatibility mode.

Rob

Hi Rob

There’s no display.actualPixelWidth but assuming you mean display.pixelWidth that gives me 640x1136 on an iPhone 6 so yes that points to compatibility mode.

I took the full UILaunchImages table from the docs; here’s my build.settings

(and I’ve got a 750x1334 image called  Default-667h@2x.png )

settings = { plugins = { ["plugin.facebook.v4"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true, ["android-kindle"]=true } }, ["plugin.notifications"] = { publisherId = "com.coronalabs" }, }, iphone = { plist= { MinimumOSVersion = "7.0", UIApplicationExitsOnSuspend = false, UIPrerenderedIcon = true, UIStatusBarHidden = true, FacebookAppID = "166095236933652", CFBundleURLTypes = { { CFBundleURLSchemes = { "fb166095236933652", } } }, CFBundleShortVersionString = "0.0.5", CFBundleVersion = "0.0.5", CFBundleIdentifier = "com.zubanubi.tombola", --CFBundleIconFile = "Icon.png", CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-167.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png" }, UILaunchImages = { { -- iPhone 4 Portrait ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{320, 480}" }, { -- iPhone 4 LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{320, 480}" }, { -- iPhone 4 LandscapeRight ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{320, 480}" }, { -- iPhone 5 Portrait ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-568h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{320, 568}" }, { -- iPhone 5 LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-568h", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{320, 568}" }, { -- iPhone 5 LandscapeRight ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-568h", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{320, 568}" }, { -- iPad Portrait ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-Portrait", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{768, 1024}" }, { -- iPad LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-Landscape", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{768, 1024}" }, { -- iPad LandscapeRight ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-Landscape", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{768, 1024}" }, { -- iPhone 6 Portrait ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-667h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{375, 667}" }, { -- iPhone 6 LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-667h", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{375, 667}" }, { -- iPhone 6 LandscapeRight ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-667h", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{375, 667}" }, { -- iPhone 6 Plus Portrait ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-736h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{414, 736}" }, { -- iPhone 6 Plus LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-Landscape-736h", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{414, 736}" }, { -- iPhone 6 Plus LandscapeRight ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-Landscape-736h", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{414, 736}" }, { -- iPad Pro Portrait ["UILaunchImageMinimumOSVersion"] = "9.0", ["UILaunchImageName"] = "Default-Portrait-1366", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{1024, 1366}" }, { -- iPad Pro Landscape Right ["UILaunchImageMinimumOSVersion"] = "9.0", ["UILaunchImageName"] = "Default-Landscape-1366", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{1024, 1366}" }, { -- iPad Pro Landscape Left ["UILaunchImageMinimumOSVersion"] = "9.0", ["UILaunchImageName"] = "Default-Landscape-1366", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{1024, 1366}" }, }, -- Whitelist Facebook apps LSApplicationQueriesSchemes = { "fb", -- Needed for the facebook-v4.isFacebookAppEnabled() API "fbapi", "fbauth2", "fb-messenger-api", "fbshareextension" }, }, }, orientation = { default = "portrait", supported = { "portait", "portraitUpsideDown", }, }, android = { facebookAppId = "166095236933652", versionCode = "1", usesPermissions = { "android.permission.INTERNET", "android.permission.WRITE\_EXTERNAL\_STORAGE", --"android.permission.ACCESS\_FINE\_LOCATION", --"android.permission.ACCESS\_COARSE\_LOCATION", }, usesFeatures = { --{ name = "android.hardware.camera", required = true }, --{ name = "android.hardware.location", required = false }, --{ name = "android.hardware.location.gps", required = false }, --{ name = "android.hardware.location.network", required = false }, }, } }

Sorry Rob - I’m not sure why this isn’t working.  The UILaunchImages table looks correct to me…?

Go grab this sample app and run it.

Then try it with your images.  Look at the build.settings and compare to yours. I get the right image and right pixelHeight/Width images on my iPhone 6.

https://github.com/coronarob/UILaunchImages

Rob

Hi Rob

Many thanks for following up on this.

Using that sample I got 640x1136 using the latest stable (2016.2996)

But… then I upgraded to the latest daily build (2017.3023), and then I got the 750x1334

Hurrah.  Many thanks for your help

Tom

Are there any plans to make it so that you don’t need to keep all the launch images / icons in the root folder?  There’s so many of them now…

Ideally, for newbie-startup-speed, you’d be able to browse for an icon image in the simulator and have it run the convert scripts to make basic icons and launch images for all the sizes… then when you’re further down the app development path later you could refine these by putting your own in to the project…

He says :slight_smile:

Apple would prefer you not do that. They want you to create a Storyboard in Xcode and out put a dynamic launch screen.  We have an older tutorial with Xcode 6. I’m 100% sure that it won’t match up with Xcode 8, but I know people have recently used it, adapted it to Xcode 8’s interface perhaps with the help of other Tutorials. There isn’t anything Corona specific until it comes time to adding to build.settings and that hasn’t changed since our tutorial.

This removes all launch images and replaces with an .xassets object. This drastically simplifies build.settings. And while this is probably the preferable way to do this, we need to document a way for people to do this without requiring them to actually use Xcode.

Rob

I checked the tutorial and it’s actually still relevant for Xcode 8.

Rob

Thanks, I’ll take a look at that.

I think I was wrong above about the pixelWidth/Height being different between the stable build and latest daily.  I think actually it’s something to do with Live Builds … when I do a live build I get 640x1136 but without it I get 750x1334 …

Ahhhhhh… has it cached an old build.settings from when I first built it, maybe?  (I did restart the simulator and live server)

Anyway, I have a solution so I’m happy :slight_smile:

Changes to build.settings generally requires you to make a new live build and install it.

Rob