Xamarin Quick Tip : Identifying if a device is an iPad or an iPhone using UserInterfaceIdiom

Falafel Software Bloggers
Falafel Software
Published in
2 min readOct 28, 2016

If you simply need to determine whether the device using your application is an iPad or iPhone in Xamarin.iOS without additional ceremony, look no further. The UserInterfaceIdiom can be used to solve this problem.

iPad and iPhone identification using UserInterfaceIdiom

iPad and iPhone

Identification of the Device Type using UserInterfaceIdiom

In order to identify the device type using the application. The following code can be used:

var idiom = UIKit.UIDevice.CurrentDevice.UserInterfaceIdiom;

The UserInterfaceIdiom property will return any of the following enum values:

  • CarPlay
  • Pad (iPad)
  • Phone (iPhone)
  • TV
  • Unspecified

Alternatives for a more granular Device Identification

If you require a more granular approach to device identification, such as distinguishing between the specific models of each device, there are a couple more alternatives that I would like to highlight:

This post should set you on the right path if you need to identify the iOS hardware of the device using the application.

Originally published at Falafel Software Blog.

--

--