How can I determine programmatically that my app is running on an iPhone, iPad or iPhone 4? - iphone

I just finish my iPhone game using cocos2d. But before I put it on the AppStore, I'd like to make it work on iPad (which have a bigger screen) and iPhone 4 (which have a bigger resolution).
So, how can I determine programmatically that my app is running on an iPhone, iPad or iPhone 4, to be able to use the correct coordinates / images in my game?
Thanks for your help!

Between iPad and iPhone — Already answered many times.
Between iPhone and iPhone 4 — The size reported is still 320×480, so you don't need to change anything about the coordinates. Create an #2x alternative for the images if you need a high resolution UI image.

Related

Can I scale my iPAD app to fit on a iphone automatically

I have an iPad application built in objective-c i wanted to know if there were any tricks with UIWindow to scale the app to run on an iphone in landscope mode. So that all my assumptions of the frames being ipad size would be ok but it would fit on an iphone. Just to carry around pocket demos etc. I realize things would be hard to press.
No, you have it backwards: apps made for the phone can run on the ipad unaltered in either 2x mode (stretched) or in a letterbox.

xcode Use the same images and xibs for iphone and ipad

I am at the start of a new game. My last game was for the iPhone, and it had to double up for iPad.
Now with the iPhone 5 screen being larger than 4, and iPad and iPad mini, I want to program the game to display the correct size images. Is it possible to design large graphic for iPad and use the same images for iPhone (just display the image smaller when using iPhone 4 etc) or is it best to use two lots of images, iPad version and iPhone version? The problem here would be the size of the app. The App would double the download and install size as the graphics would be quite large, and this isnt something I want to do.
Is it possible to use the same xib for ipad and iphone, and then I could just get the code to detect the screen size and display the game correctly based on that?
Also, I have started the project as Cocos2d with Box2d with the latest download of Cocos2d. It starts off with just the code, should I work from the storyboard instead?
thanks
1) You cannot use single xib file for both iPhone and iPad (programmatically you can but that would screw your app).
2) While doing development using Cocos2D, my experience suggests do not use any xib or storyboard file. Else you will end up in a mess.
3) As far as the question for image size for different iOS devices is concerned, I would suggest you to go with separate images (only typical ones) for different iOS devices. If you have some buttons and simple curve based UI go for CoreGraphics so that you do not need those images. Only use images that are typical ones and use CoreGraphics for rest of the images

Non retina iPad app working fine on retina display iPad

I have a iPad app which is NOT modified for the new iPad with retina display. But, to my surprise(pleasant) the app is working great without any issues in the retina display iPad. The graphics are just the same. I dont even see any pixelation issues. Can some one explain me the reason behind this? Did apple do something from their end in order to get the non retina apps to work the same way in retina display iPad?
Text and framework images are in high resolution, without the explicit need of the application to do anything.
What does look different are the images you provide with your app, so if your app has a custom UI that is not retina ready, it will look bad.
The same applies to the retina iPhone. Text is displayed in a double density font, and any embedded images are also displayed x2. In most cases the only change that you make for retina displays is to add double density images, but that is optional.
Edit: This also works with iPhone apps running on the iPad, with one massive gotcha. If an iPhone only app runs on the iPad, it is displayed double density, in portrait mode. But the only way that a developer can actually get his app onto an iPad is to mark it as universal, which means that it loses this support.

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.

Will my iphone 3gs app work ok on iphone 4?

So I'm currently making an app that supports both iphone 3gs and ipad (this is a universal binary app).
What I'm wondering is how will iphone 4 users view my app, will they see it pixelated? will they not see it full screen since my iphone 3gs is on a smaller resolution?
I don't have an iphone 4 yet but I'd rather just release this app as is - just for 3gs and ipad. Is there anything that I must know / any precautions etc? Oh (i just thought of this) is there an iphone 4.0 simulator so i can check out if my app works okay?
Thanks!
Basically any bitmap graphics (PNG files) will look a little blurry on the iPhone 4's Retina display.
The easiest way to fix this is to make double scaled versions (100x100 becomes 200x200) of all your PNG files and add them to your project suffixed with "#2x.png". In other words, MyBitmap.png will become MyBitmap#2x.png. Luckily your code doesn't have to change. On the iPhone 4 the OS will automatically choose a #2x.png instead of the regular one when you do:
UIImage *myBitmap = [UIImage imageNamed:#”MyBitmap.png”];
Xib files will also use the #2x.png if there is one available.
Other than that there's also launch images and Application Icons to worry about. This blog has a good summary.
Yes you can change your device type, by in the simulator pressing: Hardware->Device->iPhone 4 If you don't have it you might want download the latest devevloper tools.
Also you might have to press Window->Scale->100%