📜 ⬆️ ⬇️

Updating Xamarin apps for iOS on Iphone X

Hi, Habr! I present to your attention the translation of the article Updating Xamarin.iOS for iPhone X by John Miller.

The most significant event at Apple this year, of course, was the release of the Iphone X. The latest Super Retina display creates a stunning immersive effect compared to what we have ever had to experience when interacting with an iPhone. And, probably due to such changes, developers of mobile applications on Xamarin are wondering what changes need to be made to their applications. So, first let's take a look at how to prepare applications for the 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 already done this, then you need to read the documentation about getting started with iOS 11. Then After the update, you can start your Iphone simulator and see how the application behaves. Pay particular attention to areas of the application that do not use automatic layout of interface elements (Auto Layout), and those that display the content in full screen mode. If your application supports horizontal mode, do not forget to turn the simulator and make sure that the interface in this mode is displayed correctly. And if the application on the Iphone is launched, but does not use the screen resolution to the full, then most likely the reason is the absence of the launch screen storyboard (Launch Screen Storyboard). You can read the documentation about getting this setting on the official website.
')
image

Support safe display zones


If you already use 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 areas manually composed. iOS 11 offers a new build tool called SafeAreaLayoutGuide. It allows you to limit the visibility of the application area, which is correctly displayed on the screen of any iPhone. With SafeAreaLayoutGuide, you can make sure that the content will not be clipped 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 the empty Storyboard space
  2. Select Properties in Visual Studio to see the settings.
  3. Create a constraint using Auto Layout, and you will see green dotted lines pointing to safe areas.


Updating the interface in applications on the iPhone X


Carefully study the display of the interface elements of the application in full-screen mode and make sure that they are not cropped or hidden behind the “Home” button.
On the official website of Xamarin, Apple’s high-quality informational articles are available on updating applications for work on the iPhone X with a lot of videos and tutorials on 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 set up an application for iOS 11 using Xamarin.Forms .

And, if you are still just getting into the work with iOS 11, be sure to check out our introduction to this version , where all the details about the updates, as well as additional information about upgrading your applications to iOS 11 , are listed.

Source: https://habr.com/ru/post/342766/


All Articles