Why can't I view PNG images within an iOS application's bundle? - iphone

When looking in a compiled .app bundle, I see PNG images used as resources for this application. However, when I try to view them, they come up blank.
Why can't I view these PNG images from compiled iOS apps? Is there a way to do so?

You should not use other people assets without their permission.
You are running into the fact that PNG files are optimized during the file copy phase of an iOS build. You have to revert the optimization to view them.
pngcrush -revert-iphone-optimizations <filename>
Apple has published a Tech note about Viewing iPhone-Optimized PNGs.

Related

iOS (iPhone) clear images from application cache

I have problem with images on my iPhone when I delete it. I clear image from disk, I remove reference in XCode, I delete app from my iPhone and when I run app again the image is still there.
Any suggestion how I can completely remove image from my project?
Lit sounds like you are adding images to your Xcode project and copying them to the app. Then you removed them from Xcode and observe that they aren't removed from the app.
In this case, clean the project.
Xcode isn't very good at removing files from an already built app when the source file is removed from the project.

Retina images (#2x~ipad) not loaded if iPad image doesn't exist (~ipad)

I have something strange in my app.
If in the ressources I have 2 files named : myFile~ipad.png and myFile#2x~ipad.png the retina image is loaded on iPad retina as it should be.
But If i have two files named myFile.png and myFile#2x~ipad.png, the retina images is never loaded and myFiles.png is used for all devices.
Is this normal ? The problem is that I want to use the image myFile.png for iPhone, iPhone retina and iPad and the image myFile#2x~ipad.png for iPad retina so I can't put the extension ~ipad beyond myFile.png.
Use symlink. I just google it, and didn't say it couldn't be done, but most of it points to symlink in an SD card.
You can have the same image "myFile.png" with different name as myFile~ipad.png so that you can have same result for iPhone, iPhone retina and iPad. And "myFile#2x~ipad.png" image for ipad retina display.
hope this will help.
We tried using symlinks, but it turns out that in the built app, the symlinks actually turned into copies of the images they linked to. Xcode resolves symlinks by copying the source file. So you can use symlinks for convenience, but not to save storage space in the built app.

How can I change the initial loading image

How can I change the initial image when app is loading. Currently it is set to default.jpg but I don't know where in the project I can change it.
Thanks
You change it in the Info.plist. It is also my understanding that this image must be a .png file, not a .jpg.
You are looking for file called 'Default.png'. In xCode it will likely be in your Resources folder.
If you are supporting anything other than a regular iPhone (so retina or iPad) you will need extra Launch images

Can i use a jpeg image for launching Screen

i was currently in to an app development and i have added a launcher screen in JPEG format which is displayed both in simulator and device .. but does it create any problem with apple approval guidelines ?
Update for iOS 8+: you can now use XIB-based launch assets, which is by far the best approach to reduce file size and re-use the same assets for multiple screens sizes. Also, since XIBs support JPG assets, you can always embed JPGs onto XIB files now too!
The Apple documentation pre iOS 8 (now removed), explicitly stated that only PNG is allowed for the launch image:
App Launch (Default) Images
Every app must provide at least one launch image. This image is
typically in a file named Default.png that displays your app’s initial
screen in a portrait orientation. However, you can also provide other
launch images to be used under different launch conditions. All launch
images must be PNG files and must reside in the top level of your
app’s bundle directory. (Avoid using interlaced PNGs.)
I can't speak to how accurate this document is, but it seems they are pretty specific on this point.
My advice: use 8-bit PNG's, and if your files are getting to big, simply don't include the #2x versions for the retina iPad. The 1x version upscales reasonably well on the retina iPad, and better than bloating your app by 5MB+
Yes ofcourse you can use JPEG image in Launch screen or anywhere in project.NO it absolutely does not create any problems in approval process of Apple.So go ahead and code!
Use a png if you can; not only is png artwork better visually, but iOS is optimised for png files.
While it is true Apple won't reject your app for using a jpeg, your users might.
NO you should not use jpgs
Here are apple recomendations
Note: For all images and icons, the PNG format is recommended.
The standard bit depth for icons and images is 24 bits (8 bits each for red, green, and blue), plus an 8-bit alpha channel.
You do not need to constrain your palette to web-safe colors. Although you can use alpha transparency in the icons you create for navigation bars, toolbars, and tab bars, do not use it in application icons.
You can only use PNG files for the launch images. Here is the proof.
Yes , you can choose any one from JPEG/PNG.There is no guidelines from apple to choose type of image.
For more information you can follow apple launch image guidelines.
but I assume that PNGs are more preferable because Apple seems to use PNGs virtually everywhere in iPhone OS.

iPhone App finds and loads image not inside .app

I've taken an existing iPhone app, and stripped it down to become a "New App" starter project. It has a loading screen, which references an image called "Loading_Background.png". But when I go to the .app and do "Show Package Contents", I don't see any image with this name. There isn't an image with this name in the Copy Bundle Resources in the project, either.
How is the iPhone finding and loading this non-existent image? Is it somehow finding that image in the original application which is installed on the same iPhone?
Try a clean build (and also delete the app off the iphone) sounds like you are getting something from a past build.
Possibly. If you keep the same Bundle ID, your iPhone can confuse the two apps.