To run the example project, clone the repo, and run pod install
from the Example
directory first.
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.
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];
If you just want to know the physical size of the screen, use the category on UIDevice:
let screenHeightInMeters = UIDevice.currentDevice().irl_deviceHeight
IRLSize is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "IRLSize"
Jeff Kelley ([email protected]) at Detroit Labs.
IRLSize is available under the MIT license. See the LICENSE file for more info.