开发者

App running on iPhone 4 has a 320x480 resolution instead of 640x960

开发者 https://www.devze.com 2023-01-23 23:58 出处:网络
I\'m creating an iPhone app, which will run on iPhone 3 and iPhone 4. To that point, I was trying to make the ima开发者_Python百科ges adjust to the resolution, but it turns out that even when running

I'm creating an iPhone app, which will run on iPhone 3 and iPhone 4.

To that point, I was trying to make the ima开发者_Python百科ges adjust to the resolution, but it turns out that even when running on the iPhone 4, the size of my window is 320x480.

On the XIB I specified "fullscreen at launch" and for the ViewController I even specified "Wants fullscreen", but I can never get it to recognise the actual resolution.

Am I missing something?


Is it running full screen on your iPhone 4? (I don't mean what resolution is being reported, I mean are there black bars around the app - I bet there aren't).

iOS is 'magical' in that you just deal with iPhone 3 size things i.e. xibs etc and it scales it correctly for you on the iPhone 4. You will always see the smaller resolution when you query the display.

To get images to load the correct resolution just create two versions i.e.

myImage.png myImage@2x.png

Make the second one exactly twice the size of the first and the iPhone will do the rest.


PS There's a property that's been added to UIImageView called scale - it's how the iPhone knows how large to render an image - have a look at the docs here.

0

精彩评论

暂无评论...
验证码 换一张
取 消