- Home /
Aspect ratio of the IPhone?
I need the aspect ratio of the iPhone so I can put a HUD in my game. Also, should I be weary if there are different versions with different aspect ratios? How do I tell my game to switch accordingly?
Answer by CHPedersen · Apr 27, 2011 at 07:06 AM
According to wikipedia's article, it's resolution is 640 x 960, which would indicate an aspect ratio of 4:6, right?
Since 4x160 = 640 and 6x160 = 960.
Edit: D'oh, 4:6 = 2:3. ;)
Answer by loopyllama · Apr 27, 2011 at 07:06 AM
<= iphone3/itouch 3 is 480x320 || 320x480 so aspect ratio is 3:2 || 2:3
iphone4/itouch4 is 960x640 || 640x960 so aspect ratio is 3:2 || 2:3
ipad1/ipad2 is 1024x768 || 768x1024 so aspect ratio is 4:3 || 3:4
to tell which you have you can use Screen.width or Screen.currentResolution or iPhoneGeneration or iPhoneSettings.generation. I think the iPhoneGeneration is obsolete...
Answer by Ashkan_gc · Apr 27, 2011 at 07:10 AM
you can crate resolution independent guis.see this question.
but having different aspect ratios is different. you might need to design two guis for 4-3 and 16-9 ratios, images might need some tricks or be clamped. iphone res is 480-320 and ipad's res is 1024-768. iphone 4's resolution is different. you can set your unity's platform to iphone and then in top left corner of gameview you can set the resolution to all of those resolutions and see how your gui will looklike there. you ca download a trial from the website if you don't have unity iphone.