开发者

iphone 5 screen size and ratio problem

开发者 https://www.devze.com 2023-04-02 02:17 出处:网络
i am worry about the iphone 5 screen size will change to 4 inch or even change its ratio. i only use absolute value in my game, which apple recommends against.

i am worry about the iphone 5 screen size will change to 4 inch or even change its ratio. i only use absolute value in my game, which apple recommends against.

mySprite.position = ccp(30, 50);//bad style, but i still use it

should be:

myS开发者_如何转开发prite.position = ccp(screenSize.width / 15, screenSize.height / 20);

but i don't think i can change all of my code. so is it necessary for me to wait until iphone 5 & ios 5 comes out, and make both versions of them? maybe when iphone 5 comes out, all new apps should support both screen size. so should i make the app immediately before iphone 5 (since i don't think i can make a 'universal app') and hope that apple have a solution for old apps(like ipad 2x solution for iphone app)


For those people who vote down the answer, please check the date of the question (Sep 4'11, before the iPhone 4S published!), it's actually talking about the iPhone 4S and iOS 5 in 2011! Not the real iPhone 5 in 2012! People called the 5th generation iPhone "iPhone 5" at that time, Who knows why Apple called its 6th generation iPhone "iPhone 5"?

If you still want to vote it down, I am sorry that I didn't edit my answer about the iPhone 4S after ONE YEAR later.


Also, I edited the answer for the new iPhone 5 and iOS 6 in 2012:

You'd better use the main screen's size as the size of your RootViewController's view, and then use autoresizingMask (view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight for example) to let all of your subviews automatically change its size or position.

Also if your App only supports iOS 6, then you can use the new Auto Layout as well.


Take a look at the iPad - it has a different aspect ratio but still runs iPhone apps.

But @Lee Armstrong's comment is right - basing your app's design on devices that are just rumours probably isn't a good idea!


The fact that people still use the ancient xib technology means you're safe. In xibs, all values are hardcoded as absolute points in the coordinate space. So if Apple releases a device with a different screen size, they can't assume apps for the old screen size will scale accordingly.

I don't know anything about the likelihood of a phone with a different screen size being released. But if they do, they will probably do something like they did on the iPad, where iPhone apps run in their original ratio and size.

Another important point is that apps very often have graphics in them that aren't stretchable. Think background patterns, gradients, custom buttons, etc.

0

精彩评论

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

关注公众号