I tried [[UIScreen mainScreen] bounds]
to get the screen size of a resizable iPhone on Xcode 6
simulator. But it doesn't take into account the new screen width and screen height I assign to it.
Is there a better way to get the screen size? Even if I set the screen size to 320x800 the [[UIScreen mainScreen] bounds]
returns me (CGRect) $0 = origin=(x=0, y=0) size=(width=768, height=1024)
Do following
CGRect Rect=[[UIScreen mainScreen] bounds];
So it will preserves the bounds in the rect. try once.
In Swift 4.0, 3.0
let screenRect:CGRect = UIScreen.main.bounds
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With