Skip to content

Latest commit

 

History

History
57 lines (36 loc) · 1.67 KB

README.md

File metadata and controls

57 lines (36 loc) · 1.67 KB

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.