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.
Related
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.
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.
I have an app which needs to be upgraded all the PNG files to also support retina. How is this done in regards to filenames when I have a folder with about 40 files for buttons etc.
Sorry for the "stupid" question but we all have to start somewhere..
For images within the app, just double the size of the image and put an #2x suffix on the image. For example, if you have a 100px x 44px button image named MyButton.png. You'd create a 200px x 88px image named MyButton#2x.png. Place that button in the same folder as the other image and the OS will take care of the rest for you.
Secondly,
If you're worried about nomenclature for the Launch Images and the image icons I'd recommend reading up on the freshly updated programming guide and human interface guidelines.
Lastly,
I created a nice little inforgraphic that combines the requirements into an easier to read format. Feel free to check it out. It lists what's required, the names of the new image files and the sizes apple requires for those images. Hope this helps!
Programming Guide - Images
Human Interface Guidelines - Images
iOS Image Guide - Inforgraphic
I'm making a Universal App using MonoTouch, and I'm adding my Default-Portrait.png file. That file alone (a 768x1004 .png file) is adding 711k to the size of the app. My app itself is only about 7 megs, so it's adding 10% just for the splash screen.
I could easily make this thing an 80k jpg file instead of a png, but the device doesn't seem to look for a .jpg file. Does anyone have tips for reducing the size of this launch art?
At this point, I'm thinking I might just leave the launch art out and load my own jpg and display it as soon as I have the ability to. That'll keep my app size down, but it's not as nice as having the launch art scale in immediately like most apps do.
Hmmm...given the screen of the iPad and the visual quality users are expecting, I'd just leave it like that.
But if you do want to reduce the disk space, try going to Project > Edit Project Settings > Build (tab at top), and searching for a parameter called "Compress PNG Files." Make sure that's checked. It'll run the pngcrush utility before loading the file onto disk (check the size of your IPA archive after to see if it had any effect).
pngcrush is nice as well, however that will not reduce the quality of you image. If reducing the quality of the image is an option for you, then you might try this tool: http://www.punypng.com/ - or just use an image editing tool to "optimize" the image ...
I recommend pngout if you want to really squeeze those PNGs down, and this won't cost you any quality. It simply removes unnecessary metadata (like pngcrush) and uses its own compression algorithm which is compatible with the regular decompressor used in PNG (zlib). It's really slow, though.
A simpler option is to try "Save for web" in your image manipulation program of choice. Exporting from Acorn (not just the regular save) sometimes gives me vastly smaller files. This is especially true for default images which have large, uniform areas in one colour (screenshots, a small logo in the middle of a black screen).
Is there any reason why you want to reduce the file size that badly? I don't think it matters in your case. I just checked 3 of my apps and the Default.png (of various portrait/landscape varieties) is between 29KB and 422KB, so whilst yours do seem a little heavy, your still way under the 3G download limit.
Are you positive it's adding that much to the size of the app? Did you compare a before and after?
Xcode uses pngcrush on the images for you. I know because I just tried to substitue jpegs for pngs and got the following result:
So, in short, there's not a lot to be done except simplify the image beforehand. Xcode will handle the rest.
I've got a mysterious problem with images and caching. In my project I've got 20 photos that elegantly fade in and out with a random function that changes up the order a bit.
I found that I didn't like one image in particular, image_1.png and wanted to push it back in the rotation (each time the app starts the images start with image_1.png). So, I swapped the name of image_1.png with that of image_16.png. When I look at image in the project folder and in Resources indeed the images are as they should be but when I run the app its the same old image that starts things out.
I have reset the sim, deleted the app from my iPhone, removed the images from the project and reimported them and still the same image.
Even odder.. I have an image_0.png that is no longer in the project file at all ... its not even on my hard drive.... but it shows up as well.
Do I have a ghost in my Mac or is this just seriously persistent cache?
Clean All Targets
Sounds like a persistent cache.
Let me guess: you have your images in a directory that you add to your project as a reference?
Yeah, that stuff's weird and buggy. Even in the latest xcode. I find it helps to recreate the folder with the new contents in a different place, then remove the old one from the project and add the new one. Perhaps even closing the project before re-adding.
XCode sucks.