How to add seperate iPad and iPhone images in spritebuilder- Cocos2d 3.2 - iphone

I love that Spritebuilder takes the retina iPad image and automatically makes the scaled down iPhone images.
I make one image (ipad retina), And spritebuilder makes the iPhone ones automatically:
But for certain buttons/sprites, I wanted to make both the iPad and iPhone images myself. How do I add custom iPhone AND iPad versions for an image that can be used in the Spritebuilder UI?
Eg. Use one image for iPad (retina), But use another one for iPhone.
Also, how do I add something like an external spritesheet into my Spritebuilder XCode project? (Adding the -hd or -ipadhd suffix no longer works, it just always chooses the one with no suffix) -I heard is has something to do with 'resources-phone'?

If you select an image in SB you can see its preview image in the top half of the file view. Below the image are 4 smaller buttons labelled auto, one for each platform (phone, phonehd, tablet, tablethd).
For instance, select your ipad image, then drag and drop another image to that image's phone and phonehd auto buttons. That way they override the original image when the app is run on a phone or phonehd device.

Related

Do I still need low-resolution images for using Interface Builder when developing iPhone app for iOS 7?

I started to develop an iPhone app for iOS 7.
Since iOS 7 does not support devices with non-retina display for the iPhone/iPod touch, and it uses high-resolution images on non-retina iPads (iPad 2 and iPad mini) in the iPhone emulation mode, now I think we don't need to provide low-resolution images when developing an iPhone-only app which deployment target is iOS 7.
I thought it's great, but soon I faced a problem when I used a Storyboard; apparently Interface Builder can not display high-resolution images which file names end with #2x.
I feel it's really pity that we have to provide the low-resolution images ONLY for the Interface Builder...
Is there any good workaround for this? Or do we still have to provide low-resolution images if we want to use the Interface Builder?
You are correct that an iOS 7 iPhone-only app is not going to run on any single-resolution devices, so you only need to provide double-resolution images. Do what you have always done in the past: refer to your image as myImage but name the actual image file myImage#2x.png. Even better, use the asset catalog! Place the double-resolution image in the 2x slot and refer to it by the name of that image set. Either way, this will work perfectly both in the storyboard editor and in the running app; in the storyboard editor, the Media Library and things like buttons that have images will display your image's name as myImage.

How do I provide iPad and iPhone 5 versions if I use .xib files?

I have a very simple app that just displays a block of text every time you touch the screen. I have a graphic behind the text, that the basics of it.
I made it back in 2010 using a .xib file to create the text field and the image.
I'm now attempting to make it fit both iPhone 5 and both iPad and iPad Retina.
I can't simply stretch out the existing .xib layout because it just accepts and renders the last one I do. (If I stretch to iPhone 5 resolution it goes off the screen on an iPhone 4S).
Is there anyway to reference different .xib files based on the iOS device?
Thank You.
According to the documentation, you can use:
myNibName~ipad.xib and
myNibName~iphone.xib
and the correct xib will be loaded depending on the device.
You can read iOS Supports Device-Specific Resources.
EDIT:
how do you distinguish between iPhone 3.5" vs iPhone 4.0"
there is no device modifier specific to the iPhone 4". You will have to define your nib in a way that it can "stretch" vertically.
The only mechanism is a iPhone 4" specific Default-586#2x.png file. If you provide it, then the whole screen area will be available to your app.
If you do not provide it, then the app will run in a special mode whereby its content is presented in a 3.5" area. The remaining area is filled with a top and a bottom black band.
iPad vs iPad Retina?
nothing special here, since the 2 devices share the same "logical" resolution of 768x1024 pixels. As usual, you can use #2x modifier to supply specific retina-resolution images; and, if you need it, you can use ~ipad#2x modifier to supply retina iPad-only images.
E.g.:
iconImage.png -> non-retina iPhone version
iconImage#2x.png -> retina iPhone version (also retina iPad version if no ~iPad is given)
iconImage~iPad.png -> non-retina iPad version
iconImage~iPad#2x.png -> retina iPad version
EDIT:
To make your UI stretch, go to the metrics pane in IB and set the vertical spring for the view height (this is the inner vertical double arrow in the picture below).
You will have to find your way through this a bit, especially if you have a lot of subviews.

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

iOS Images for iPhone and iPad and Rotation of Images

I read on the apple website that when you choose images to display say for a background image it has to be of certain quality. See this link.
I am developing an app for iOS 5 with XCode 4.3.2.
How do I know if my device is a high-resolution one?
For setting a background image, when you do rotations of a device say left or right, do you need to include a much wider version of that image? I am doing a header and setting it as my background with a name "My Apple App" in the background. Do I need to make a wider version so it can stretch?

How do I make an app icon for different versions of iOS?

I want iPhone app icon and graphic (not only the app icon shows on springboard but also in app inner view) auto meet on OS3 device and OS4 retina device , does it exist a way auto meet but coding ? as I know that we can set the icon configure in setting.plist to define the different app icon on springboard but seem no way to set the inner icon or graphic of the app ....
Every graphic that you display on a normal-resolution device has an #2x counterpart for a high-resolution device. This applies both to app icons and to the graphics you use within your app.
For example, if you had an image called navbar.png and a hi-res one called navbar#2x.png both in your Xcode project, when you specify it as the image of a UIImageView in Interface Builder or when you specify it in code:
[UIImage imageNamed:#"navbar"];
iOS will automatically pick navbar#2x.png for hi-res devices without you having to write any extra code.
Create all of your graphic assets at the two sizes, then name the double-sized assets with "#2x" at the end of the name. ie: Icon.png and Icon#2x.png. The iPhone will automatically choose the correct one.