iPhone 5 - what naming convention the new images have to follow? - iphone

What name convention the new images have to have to be loaded by the new iPhone 5?
We see that we have to have 3 default images to be loaded by the device
Default.png
Default#2x.png and
Default-568h#2x.png
what about the other images used by an app?
Is there a naming convention that will automatically load the correct image?

The new default is Default-568h#2x.png. (note hyphen)
There is no other corresponding change. If you need a different image for the new iPhone 5 screen then you have to create it as a separate name. There is no 1x/2x/new phone auto switching behavior.

If you are looking for something similar to ~iPad or ~iPhone (like ~586h) there isn't anything build in like that. But you can easily add it yourself by expanding UIImage class.
Have a look at this source snippet (UIImage+Retina4) for information about how to achieve. Just add this UIImage category and there will be support for ~568h#2x files.

I solve this problem here. Just add #2x~568h suffix to images or ~568h to xib's. Also you can use this images in xib's.

With the introduction of Asset Catalog in Xcode 5, all you have to do with the images is simple drag and drop to its corrosponding related areas. Everything else will be handled by the Xcode itself..
You can create new catalog by going to the above mentions option in the screenshot.

Related

Is there a way to insert an image in Xcode?

I'm very new to Xcode and Swift, so for now I'm creating a UI that requires an image to appear on the screen. I would like to add the image to the LaunchScreen.storyboard file in Xcode. Can anybody help me?
I'm very new to Xcode and Swift, so for now I'm creating a UI that requires an image to appear on the screen. I would like to add the image to the LaunchScreen.storyboard file in Xcode. Can anybody help me?
Images are typically stored in .xcassets files, which show up as folders in your project. Your project probably already has one called Assets.xcassets, and you can just drag and drop images into that file. Then you can add an image view to your LaunchScreen.storyboard and set it to use the image you just added.
Beyond that, let me suggest that you go through some of Apple's SwiftUI tutorials. They'll help you learn about Swift, but you'll also get a lot of exposure to just using Xcode. If you have to figure it all out on your own, it'll take a lot longer.

Assets Catalog ImageSet - Edit Contents.json

I often use iPhone 2x image also for iPad 1x. By adjusting the layout the app still looks nice.
Asset Catalogs supports this, except for one little detail.
When I drag & drop an image to iPhone 2x and also to iPad 1x it creates a copy of the image.
I clean it up by editing Contents.json and delete the copy from the imageset.
Am I allowed to do this?
Editing the json-file does not help to reuse images and save disk space. If you build for pre iOS 7 you see that the image files are automatically generated and named in the app-bundle:
image~ipad.png
image~iphone.png
image#2x~ipad.png
image#2x~iphone.png
The main aspect of Asset Catalogs seems to improve the workflow between design and programming. It's a visual tool to structure your image data and care a little less about the naming. I heard of teams, in which designer works directly on the Asset Catalog.
Yes, it should be fine. The Contents.json file is valid and contains accurate information and the images all exist. These are the requirements that need to be met for the asset catalog to be valid.

How can i change Default Splash image in coco2D?

I am new to cocos2D.
As my title says, how can I change my default splash image?
In my project, I removed all of the built-in images (splash image) come with cocos2d when you create a project. Then I ran my app. Why do I still see the built-in image (splash image that i removed) when my project it started?
I tried to find my solution on google but i could not find anything useful.
So, please help me resolve this issue. It may be very useful for a beginner.
I think the file is called 'Default.png', and you replace it with what you want. If you've already deleted the 'Default.png' file, create a new one.
The 'Default.png' should be placed in the root.
Then Build ->Clean All Targets
Create an image 320×480 for portrait mode
Place the following
#define CC_CODE_IDE_DEBUG_SUPPORT 0
at
Appdelegate.cpp
Which is at
Framworks --. runtime-src -->classes folder
Just delete "Default.png" from your resources. And add an image with name Default.png which you want as Splash into your resources.
Thanks
Be sure you replace all the Default files in the Resources folder with your own art. For example:
Default-568#2x.png
Default.png
Default#2x.png

Screenshots for AppStore - do I combine into one image?

ITunes Connect has different buttons for uploading screenshots (e.g. one for 3.5 inch retina)
Can I use each button more than once to upload more than one screenshot - or will a second upload overwrite the first? I know it says "screenshots" (plural) but it is not clear whether that is because I need to combine several screenshots into one image and upload it. Especially since the available sizes seem to be larger than the default screenshot size that XCode produces.
OK. Found the answer by taking a plunge and just trying it. Yes, you can add a number of screenshots under each category. They are displayed for you, and it seems that you can change them later as well. So it is really easy.

Universal application iPad/iPhone image naming convention?

In my application I need to get the correct image based on the device iPad/iPhone 4/iPhone 3 device.
For example:
I have an image named a.png (width 40,height 20) for iPhone 3/iPod, and a#2x.png (width 80,height 40) for iPhone 4.
If I mentioned the code
UIImage *myImage=[UIImage imageNamed:#"a.png"];
myImage contains (80*40) image if it's iPhone 4.
myImage contains (40*20) image if it's iPod/iPhone 3.
My question is how do I get the image for iPad (60*30) like above naming convention.
I tried giving a~ipad.png as an image name and it's not working. Can you point out where there is a mistake?
And if I use the condition using [UIDevice currentDevice]; isIpod -> load(60*30) image
otherwise load images for iPhone/iPod it's working fine.
But I need to get it to work without using the condition, and using the naming convention like a.png for iPhone/iPod, a.#2x.png for iPhone 4 and likewise for iPad.
Thanks in advance.
I know it is old post, but I think Screenshot gives more clear idea about naming convention.
With latest devices: button#3x~iphone.png and button#3x~ipad.png
According to this Apple doc, there is an image naming convention for devices:
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingResources/ImageSoundResources/ImageSoundResources.html#//apple_ref/doc/uid/10000051i-CH7-SW17
It says to use "~iphone" for iPhone, and no suffix for iPad. Though anecdotally I have been told that "~ipad" also works.
There is no image naming convention for iPad, it's only for retina displays so that your images will appear crisp. If you want to support iPad then you need to create a separate layout for it (separate xib), even separate set of images in most cases because you were given a bigger layout.
You can, however, create a naming convention for yourself and pass the string name to a static function that will convert the name to an iPad / iphone depending on the device.
E.g.
[UIImage imageNamed: [MyAppUtils getImageName:#"a.png"]];
and inside the getImageName function, you can do your conversion (use the same name if iphone, else rename to something else)
Further to Nate's post, the specific documentation from Apple describing the naming convention can be found at:
Supporting High-Resolution Screens - Updating Your Image Resource Files
According to the link, the naming convention pattern is as follows:
Standard: <ImageName><device_modifier>.<filename_extension>
High resolution: <ImageName>#2x<device_modifier>.<filename_extension>
For example: "MyImage#2x~ipad.png" for a high-res iPad-specific image or "MyImage~iphone.png" for a standard-res iPhone-specific image.
I am using a "Resource Manager" that I developed first before creating any application.
This Resource Manager can decide about the naming convention after loading the resource configuration files (mostly XML).
This way everything is transparent to the programmer of the GUI, you only need to worry about creating the content :)