Skip to content
/ IRLSize Public
forked from detroit-labs/IRLSize

A library for determining the actual physical size of pixels on an iOS device.

License

Notifications You must be signed in to change notification settings

rist/IRLSize

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IRLSize

CI Status Version License Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Measuring a View

To find out the dimensions of a view on your device, use one of the following methods:

  • IRLSize size = [myView irl_dimensions];
  • float widthInMeters = [myView irl_width];
  • float heightInMeters = [myView irl_height];

If a view is not on the primary screen (i.e. if you’re using an external display) the size will always be returned as 0, 0.

Sizing a View

If you want to ensure that a view matches a certain physical size, IRLSize provides transforms to help you out:

myView.transform = [myView irl_transformForHeight:0.038];

Measuring a Device

If you just want to know the physical size of the screen, use the category on UIDevice:

let screenHeightInMeters = UIDevice.currentDevice().irl_deviceHeight

Installation

IRLSize is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "IRLSize"

Author

Jeff Kelley ([email protected]) at Detroit Labs.

License

IRLSize is available under the MIT license. See the LICENSE file for more info.

About

A library for determining the actual physical size of pixels on an iOS device.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 94.2%
  • Ruby 3.7%
  • C 2.1%