How can one get the dimensions of the screen in iOS?
Currently, I use:
lCurrentWidth = self.view.frame.size.width;
lCurrentHeight = self.view.frame.size.height;
in viewWillAppear:
and willAnimateRotationToInterfaceOrientation:duration:
The first time I get the entire screen size. The second time i get the screen minus the nav bar.
If you want screen width/height regardless of device orientation (good for sizing portrait only view controllers being launched from landscape orientations):
swift 3.0
for width
for height
We have to consider the orientation of device too:
Here is a Swift way to get screen sizes:
These are included as a standard function in:
https://github.com/goktugyil/EZSwiftExtensions
I have used these convenience methods before: