I've tried
self.frame.size
self.view!.frame.size
UIScreen.mainScreen().bounds.size
None of them work.
How do I get the correct screen size for the device?
I've tried
self.frame.size
self.view!.frame.size
UIScreen.mainScreen().bounds.size
None of them work.
How do I get the correct screen size for the device?
You can use following swift code to get the screen size.
You can use:
And if you need to get the ratio so you can detect what device they are using, you can use the following for portrait mode or switch it for landscape mode.
You can then check what ratio the device is to determine certain things.
If you want to get the correct view that the player can see, as in the bounding frame of the device's size, you can use the following guide.