Easily distinguish between iOS device screen types in Xamarin.iOS apps.
This library is a C# port of Matt Stein's ScreenType library for Objective-C and Swift.
The main way to use this library is via its UIScreen
extension method GetScreenType()
. The method returns a ScreenType
enum that represents the size of the current iPhone or iPad screen:
using UIKit;
using ScreenType;
var screenType = UIScreen.MainScreen.GetScreenType();
if (screenType == ScreenType.iPhone5_8)
{
Console.WriteLine("This device is an iPhone X.");
}
if (screenType > ScreenType.iPhone4_0)
{
Console.WriteLine("This device is larger than an iPhone 5/5s/5c.");
}
Licensed under MIT. See License file.