简体   繁体   中英

cocos2d:Convert iPhone App to Universal App

I have developed an App app in cocos2d 99.4 using cocos2d box2d project template.It works well in iPhone 4,iPod.....but i need it to convert to universal...i mean iPad version also ......i already upgraded it to iPad version....so that it runs in iPad...but in small size like iPhone...

can any one help??

Thanks

To convert your project to a universal app, see "Creating a Universal Application" in the iPad Programming Guide :

Configuring Your Xcode Project

The first step to creating a universal application is to configure your Xcode project. If you are creating a new project, you can create a universal application using the Window-based application template. If you are updating an existing project, you can use Xcode's Upgrade Current Target for iPad command to update your project:

  1. Open your Xcode project.
  2. In the Targets section, select the target you want to update to a universal application.
  3. Select Project > Upgrade Current Target for iPad and follow the prompts to create one universal application.

Xcode updates your project by modifying several build settings to support both iPhone and iPad.

Important: You should always use the Upgrade Current Target for iPad command to migrate existing projects. Do not try to migrate files manually.

For this you have to make hole app in ipad version like iphone version, Just copy your all classes and give him new name and then in your app delegate file check like this..

CGRect screen = [[UIScreen mainScreen] bounds];

CGFloat width = CGRectGetWidth(screen);

 if (width == 320)
  { 
    [[CCDirector sharedDirector] runWithScene: [iGameStart scene]];
}

if (width == 768)
{   
    [[CCDirector sharedDirector] runWithScene:[GameStart scene]];
}

by the help of this you can get on which device your app runes and according to this you can view your classes. In this way u can make a universal app in cocos2d. You have to do this because in cocos2d we don't have any view controller or any xib files......

i already done this in my game and its working perfectly and also available on itunes... And one more thing please set target as iphone/ipad......

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM