How to get a cocos2d app to use iPad? - iphone

I have an iPhone app I developed using cocos2d. I have the correct version which supports iPad. Now, how do I get it to change the screen resolution or to recognize that it is an iPad app and not an iPhone app?

You can use the UI_USER_INTERFACE_IDIOM() to figure out in what kind of device your app is running. Anyway, you should always try to layout your stuff relative to the screen size (or the root view controller's view size) so that it will adapt itself to any resolution.

You can make your app use the entire iPad screen and not run in the simulator simply by changing the target device from iPhone to iPhone/iPad in Xcode. If you want your app to show different UI and run different code on the iPad, you can check for the device by using one of several ways to detect an iPad in Objective-C.

Related

convert an ipad app to iphone app with custom views

This might be a repeat question.But i have a problem. I have an iPad app functional. The app is built in iOS 6. When i started building it i chose iPad as targeted device NOT universal. Now my client has asked for an iPhone version of it.In my iPad app i keep adding custom views as the client clicks "Add More".I add a custom view which is bunch of textfields, buttons etc.So i copied my iPad app and changed the Targeted device family to iPhone once and also Universal next time and tested it. So when i launch the app in iPhone configuration (keeping the targeted device family as Universal) my view controller stays like that on iPad. I cannot scroll the app also(not up/down..nor sideways). Is this the correct way to convert iPad app to iPhone app . Also everything is still with scale to iPad. Should i start a new project and start everything from scratch.Set the storyboard to fit according to iPhone configuration? In my research people said just change the targeted device family to Universal. But it doesn't work. Please let me know if you need more information. Thanks.
It is possible to convert the current project you have to an app that can be used universally, but it would take more time than simply just creating a new project that allows universal usage, and adding in the files of which you used for your iPad project.
Hint: You can use more than one storyboard when the project was created universally. It will automatically set this up for you.
I would also advise that you separate your files into what works universally, and what is specific for the iPhone or the iPad.
Happy Coding!
After many search i found that it possible to have an application for both Iphone and ipad devices.but in your code you should define unique ui for each device(two xib file).

Making Iphone App Working on iPad

I have created an iPhone Application, which works only on iPhone.
Now, I want that App on iPad, too.
Is there any way that I can reuse my existing iPhone XIBs to support that App on iPad. (I don't want to recreate all the XIBs for iPad separately.)
Any guidance for that?
Also, What other points I need to take care of?
Your iPhone app will work in iPad if you choose 2x zoom view. But the display will not be of the highest quality. Now rumors are there that next iPad will have retina display. So, one suggestion I can give is, when you create a new project, Choose "Universal" as the option for device family.
Depending on your app, Feature detection might be one thing you have to look out for when you try to run an app on iPad. For example, Siri is available for iPhone 4s, but not iPad 2. (Although the API for Siri isn't out yet, I'm just putting it there). Also, iPhone 4 has camera, while iPad 1 doesn't have.
Click on your target, and under "Devices" change to Universal. Now your project should run on either device.

Converting an iPhone app to an iPad app in XCode 4

I had created an iPhone app long time back. Now I want to kind of convert the same into an iPad app (the code would more or less remain the same, I only want to redesign the xib for iPad size).
Now I am using XCode 4 and after opening the app, I changed the devices to iPad. But my .xib are still showing iPhone size.
It created an iPad folder (just like Classes/Resources/Products...).
Also to add, the app now opens an iPad simulator, but let's say I have a UIWebView which just stretches to iPhone size (as in IB) and not the complete iPad size...
How and where do I redesign the xib for iPad ? What are the updates to be made when we just change the devices from iPhone to iPad ? Also I guess an iPhone app would work on iPad (using 2x), but the reverse is not true.
You should look into creating a Universal app which basically has shared code and libraries for the iPhone and iPad but different view layers (views or XIBs).
In that model you have different interfaces for both which you should. The paradigms are different - in iPhone you have small real estate so you have navigators that drill in and pop out. In iPad, you have more real estate so you have master/detail splitter views with pop-over controls. As you pointed out, even the web views are different sizes at a minimum.
If you start fresh you can create a universal app and get a feel for how it's laid out. File, new project, iOS, pick app type, next. For device family select Universal.
If you are converting, there's some resources out there. Here's some:
http://useyourloaf.com/blog/2010/4/7/converting-to-a-universal-app-part-i.html
How to convert iPhone app to universal in xcode4, if I previously converted, but deleted MainWindow-iPad?
Convert simple iPhone app to Universal app
I find it easiest to open the xibs in the separate Interface Builder that came with previous (3.2?) XCode and use its "convert to iPad using autoresize masks" option. Then I include the new separate XIBS in the project and do conditional loading (eg - use the UI_USER_INTERFACE_IDIOM() makro to load one xib or another.)

Running Iphone App on Ipad

how do you make the Iphone app run as 2X on Ipad automatically?
Building the app as both Iphone and Ipad would require you to build the Ipad from scratch right?
I prefer the 2x mode on IPad, but the build says its only geared toward Iphone. I like the user to use this app for both Iphone and Ipad, and 2x inside IPAD.
Any app built for the iPhone will run on iPad either at default size or zoomed in to 2X size, but you can't control what the user selects.
It is possible to create a universal application where you design an interface for both the iPhone and the iPad within the same app. The alternative is creating an entirely separate app for the iPad.
Whether to run an iPhone app in 1x or 2x mode on an iPad is entirely up to the user. It's not something you can control. If you want it to be fullscreen always on an iPad, you'll need to make your app handle iPads.

Is it the same write the iPhone and iPad app?

I have a question about the objective C. I am writing the iPhone application and I want to app which can also run on iPad. Is there are some change do I need to do? As I set the element in code rather than using the Interface builder. Do I need to reset the x,y,width and height for the application? Thank you very much.
You can run exactly the same app developed for iPhone on the iPad. However, it will not use the full screen of the iPad. Look at the Facebook app for instance, you can zoom it but it doesn't look very nice. If your goal is to run an iPhone app on the iPad, you don't have to bother much. If you want to really support iPad in your application you should implement a separate UI for iPad and this is supported in XCode. The iPad has of course a larger screen but also some additional layouts and controls that make apps look great on the iPad.
Have a look at http://developer.apple.com they have more information about this.