#2x images not loading in some iPhone 4 devices - iphone-4

I've added both image.png and image#2x.png in my resource folder. My problem is, in some iPhone4 devices it is loading the image#2x.png correctly while in some it is taking the image.png file. Please help me in this as I couldn't find any obvious reason for this.
Thanks in Advance

Run this test. Turn both devices off and restart them. They both should load the retina image if their iOS is the same version. I guessing the iPhone that doesn't load the retina image has a lot of background applications running. I believe if memory is below a certain threshold non-retina images are loaded instead.

Related

iPhone 6+ using #1x images

In an app I am working on, iOS seems to be choosing the #1x images over the #2x images to display on an iPhone 6+ (picks #2x properly for a normal retina 2.0 scale screen). It was not always doing this though. I am not sure if the trigger was me adding a few #3x images or upgrading to 8.1 - both were done on the same day and I did not test on device until both had been done in several places.
Anyone else seeing this?
I'm having a similar issue with the iPhone 6 Plus running iOS 8.1, built with Xcode v6.1. The problem affects images used from the bundle, but doesn't seem to affect those in an asset catalog.
If only the 1x image is available, it uses the 1x image, as expected.
If only 1x and 2x are available, it strangely uses the 1x instead of 2x.
If 1x, 2x, and 3x are available, it uses the 3x, as expected.
I put together a quick asset test that I've uploaded to GitHub.
A workaround is, to set the images via myImage=[UIImage imageNamed:#"foo.png"];
Like so, the #2x images are taken, when no #3x is available.
You can do this recursively for every screen.
iOS 8.1.1 resolved this. It was clearly an iOS bug that Apple has now fixed!

load image by "imagenamed" method in xcode 6

I feel this should be a typical question, but haven't found any answer yet. Basically what I'm trying to do is load image by imagenamed method for iPhone, iPad, Retina and non-Retina. What I'm doing is
Add 4 images into image assets. (image_name~iphone.png, image_name#2x~iphone.png, image_name~ipad.png and image_name#2x~ipad.png) and set the image set name to "image_name".
In the code I just call [UIImage imageNamed:#"image_name"] to load for different devices and resolutions.
The problem is the edges of the image look distorted for non-Retina devices like iPad mini and iPad 2. I'm thinking maybe it is not picking the right image for the non-Retina devices. Is there anything wrong with my naming conventions? Any suggestions are welcome!
sorry for the interruption. It ends up to be a problem of the image.=P

Non retina images – must I add them to xcode?

Because I made app (iphone) myself, with 200 images, I want not using non retina images.
It may be for me big problem to resize images for non retina display.
I don't have non retina display iphone, to test it.
Must I add non retina images to xcode, or not?
If I don’t add them, must I add “#2x” to all images for retina?
I tried my best to find answer for my question but there was no clear answer.
Thx for answers.
I thing it will be better make non retina display images, than buy non retina device for testing how it looks.
I have another question:
Button background needs #2x images and non retina display background images?
You must add non-retina images if the platform your targeting includes non retina devices (e.g. iOS 6 and earlier or iOS 7 iPad). If you do not, non-retina devices may not render your app correctly.
If you are not targeting a platform that supports non-retina devices (Eg iOS 7 iPhone), you may omit non-retina images. Your retina images will still need the "#2x" suffix in the file name for the system to find them.
I read somewhere that if you do not include non-retina images, the iOS will use the #2x images, scale them on the fly to non-retina sizes, but that may affect performance. Make sure you test on at least one non-retina Device to make sure it works.
This should not be too much of an issue. Test your app on the simulator using non retina and make sure your images are showing up properly. Your images should scale and won't cause a problem. It would be better if you could have both retina and non retina images but not a game beaker.

Is it possible to renderning non-retina image using retina image programmatically at runtime?

is it possible to render non-retina images using retina images programmatically at runtime?
I'm developing an universal App, and there are a lot of images in my app bundle, make my app bigger and bigger and I'm trying to downsize my app....
I can't just delete all non-retina images, cause I need to support iPad mini without retina display.
So is this possible? Using retina images to render a non-retina images, will this cause fatal performance issue? or any other side effects?
Thank you very much.
Edit1:
#troop231 Yes, the 1st generation iPad mini and 2ed generation iPad mini both supports retina assets
#bstahlhood I thought I was doing something wrong so the universal App on 1st gen iPad mini not using the #2x images, looks like this is just another limitation from Apple.
So I guess the only solution is not to support 1st gen iPad mini or I have to add both non-retina images and retina images in my App bundle?
Yes - but you need to specifically set the frame dimensions for the image in every case by the 1/2 size.
e.g. retina image is 100x100 so if you use it make sure it has CGSize(50,50)

iOS #2x applied to non-retina and not scaling correctly

I have *#2x version of every image I use in my app and as long as I test in simulator everything works fine. But for some reason on my iPod 4 (non-retina) app not only loads wrong images, but also scales them about 4 times their accual size. Answer given in this topic would help with scaling problem, but I still have to solve non-retina - retina issue.
you need to have two files one for retina and other for non-retina display
ex:
myImage#2x.png (bigger file for retina)
myImage.png (smaller file for non-retina)
and then just call [UIImage imageNamed:#"myImage"]
it should work
*make sure to clean everything, and try again.. hope that helps.
you have to make background.png (320-480) for non-retina. and background#2x.png (640-960) for retina, if you want to develope for iphone5 too you have to make a background-568h#2x.png (640-1136) too

Resources