开发者

How do I write an iPhone/iPad app to take care of different screen sizes?

With the new iPad (which has a differe开发者_如何学运维nt screen resolution of the iPhone/iPod Touch), how do I set the application to automatically size appropriately to the desired screen size?


Read the iPad Programming Guide in the 3.2 SDK beta documentation. It will tell you everything you need. The NDA means we can't talk about it here publically.


Although the iPad SDK is still under NDA at this time, the iPhone SDK which preceeds it introduced the ability to change the screen size:

- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)opts
{
  UIScreen *s = [UIScreen mainScreen];    // ask for the main screen
  [window setFrame:[s applicationFrame]]; // get the application Frame for the screen
  return YES;
}

If you have used NIBs for the UI construction, you need to ensure that they're auto-resizable in order for them to flow properly.


The issue is not in the code. It is in the project conversion from iPhone to iPad: http://www.cocos2d-iphone.org/forum/topic/4108

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜