position changing in ios5 with iphone4 and iphone 4s [closed]
-
22-03-2021 - |
سؤال
I have created the game in unity3d IOS. GUI buttons are changed their position s in iphone4 with IOS 5.But it is work well in IOS lower versions.what is the problem,i can't understand this problem.please help me.
المحلول
This might be cause because of retinal display, The difference between 4,4s and 3gs,3 and older, is the screen resolution, the points are the same, so
your positions shall be like this
float scale = ScreenSizeInPixels.width/ScreenSizeInPoints.width;
float x *= scale;
float y *= scale;
this should give you new positions
EDIT : in older iphone 3gs and older, scale value should equal to 1.0, so positions will stay the same ( Points = Pixels ), in iPhone 4 and 4s, the value will be around 2.0, that should give you new x and y
لا تنتمي إلى StackOverflow