Skip to content

Easily distinguish between iOS device screen types in Xamarin.iOS apps

License

Notifications You must be signed in to change notification settings

edsnider/screentype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ScreenType for Xamarin.iOS

NuGet Build status

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.

API Usage

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.");
}

License

Licensed under MIT. See License file.

About

Easily distinguish between iOS device screen types in Xamarin.iOS apps

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages