Update Xamarin apps for iOS on Iphone X

Hello, Habr! I present to you the translation of the Updating Xamarin.iOS Apps for the iPhone X article by John Miller.

The most significant event at Apple this year, of course, was the release of Iphone X. The latest Super Retina display creates an amazing immersive effect compared to what we have ever experienced when interacting with an iPhone. And, probably, in connection with such changes, developers of mobile applications on Xamarin are wondering what changes need to be made to their applications. So, first, let's get acquainted with how to prepare applications for Iphone X.

Analyzing an application using iPhone X Simulator


To check if your application is compatible with iPhone X, first of all, upgrade Xamarin.iOS to version 11+ and download and install Xcode 9. If you haven’t done so already, then you need to read the documentationabout getting started with iOS 11. Then, after the update, you can start your Iphone simulator and watch how the application behaves. Pay particular attention to areas of the application that do not use the automatic layout of interface elements (Auto Layout), and those that display content in full screen mode. If your application supports horizontal mode, do not forget to turn the simulator and make sure that the interface is displayed correctly in this mode too. And if the application on the Iphone launches, but does not use the screen resolution to the full, then most likely the reason is the lack of a Launch Screen Storyboard. You can read the documentation about getting this setting on the official website.

image

Support for secure display zones


If you are already using Auto Layout for the interface, then to work correctly on the iPhone X you will need to make a minimum of changes. Auto Layout and UIKit will do most of the hard work. However, you may encounter some limitations and the need to adjust manually arranged areas. iOS 11 offers a new layout tool called SafeAreaLayoutGuide. It allows you to limit the visibility of the application to an area that correctly displays on the screen of any iPhone. Using SafeAreaLayoutGuide, you can make sure that the content will not be cut off by the rounded corners of the screen, the “Home” button or the top panel with sensors. You can enable SafeAreaLayoutGuide using iOS Designer using the Storyboard settings:

  1. Click on a blank space on a storyboard
  2. Select “Properties” in Visual Studio to see the settings.
  3. Create a constraint using Auto Layout and you will see green dashed lines indicating safe areas


Interface update in applications on iPhone X


Carefully study the display of the application interface elements in full screen mode and make sure that they are not cropped or hidden behind the Home button.
Apple's official Xamarin website has high-quality informational articles on updating apps for working on the iPhone X with lots of videos and how to avoid pitfalls. If you are working with a project on Xamarin.Forms, then you should familiarize yourself with how it is even easier to configure the application for iOS 11 using Xamarin.Forms .

And, if you are just delving into working with iOS 11, be sure to check out our introduction to this version , which contains all the details about the new products, as well as additional information aboutUpgrading your apps to iOS 11 .

Also popular now: