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

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

Related

Scaling on iPhone 6+

My app is optimized for iPhone 6/6+ using the appropriate launch screen images. I did notice an interesting behavior though. I am no longer supporting non-retina screens so I deleted an image.png for which I had included in my bundle an image#2x.png but not an image#3x.png. I build and ran on an iPhone 6, expected behavior.
I build and ran on an iPhone 6+ and the image was missing completely. I ran again on 6+ simulator and the image showed. I added image#3x.png and back to expected behavior on both simulator and device. I don't recall it being this way with image to image#2x, for example if i had image it would just scale up to 2x if I did not include an image#2x.
For the sake of experiment I deleted image#3x.png and added back image.png, ran on device, image appears. Does this mean that images are being scaled from 1x to 3x? Seems it would make more sense to me to scale the 2x image to 3x?
I've just tested more by deleting image#3x.png and altering image.png but not image#2x.png. I can verify that it does use image#2x.png to scale, but for some reason image.png must be included if image#3x.png is not. I guess in this case I would just rename #2x to just.png

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

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)

#2x images not loading in some iPhone 4 devices

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.

Resources