Some images appearing small on Iphone Xs - iphone

I have an imageset in my imagesscassets with the usual #1x, #2x and #3x. It appears in the appropriate size on older iphones but the images are smaller on the Xs. Are you supposed to include larger images for the Xs or how are you supposed to handle this?

How are you setting the image?
If it's on storyboard: in attributes, is the content mode "Aspect Fit"? This would have the image render to its biggest resolution size. It might appear smaller on a bigger device. Change the content view to "Scale to fill" and it will fit into the frame you have it with in Xcode.
If you set it programmatically, did you set any attributes/constraints?

Related

background image size iphone

Normal background image is 320x480 pixels. and for retina is 640x960 pixels.
Now i have to put my background image and i have status bar(20) and navigation bar (44).
So i have to reduce 64(20+44) from 480(normal) or from 960(retina)?
if i reduce 64 from normal then normal image will be 320x416 pixels and retina will be 640x832 pixels.
if i reduce 64 from retina then normal will be 320x448 and retina will be 640x896 .
It is confusing me.. this 64(20+44) i reduce from which image type because other one will be exactly half or double of it.
Reduce from the normal size.
64px = height to remove from normal display.
128px = height to remove from the retina.
Don't forget that in the retina display the status bar and nav bar will also be 2x the height :)
You do everything based upon the 320x480 size, then retina scales everything up. Using images suffixed #2x will allow you to replace the assets (mainly UIImage) for the retina version, this doesnt work for direct resource file references or video/audio files though so just be careful.
So measure for 320 for all your assets then your retina ones will simply be twice the size

How to resize Cutom Buttons and Labels according to iphone 4?

I have an application containing number of images, custom buttons having images and number of labels.
My problem is to resize those buttons,images and labels according to iphone 4 as wel as iphone 3.
i know that images named #2x are used for high resolution, but I cant find any way to enlarge my custom buttons and labels and also those images which didn't define in code.
how do I get their exact position??
Although screen resolution of iPhone is 640x960, screen dimensions for UIKit are still 320x480 so normally you don't need to adjust coordinates for your UI elements specifically for iPhone4.
If you have '#2x' images for retina display then system will automatically draw them appropriately in the frame you had for normal display.

For UIImage, use of #2x w/o duplicating files

Beginner here. My app shows an UIImage (in a scroll view).
If you are on retina device, then it should not scroll and I set the scroll view frame to be
the exact size (640x960).
If you are not on a retina device then it should scroll, so I set the scroll view frame to the pixels (480x320).
I have this working by setting the frame sizes, as mentioned, in viewDidLoad()
So...my question is that I have to keep both images on disk. I have pix.png and pix#2x.png and they are exactly the same thing.
Any help on how to handle this? Maybe it is obvious, but not to me ;-)
thx!
In my opinion,If you load the image with the two file name, I think you should keep them on disk.If not, you can delete one of them. Nomatter what pixels size you set, the original pixels datas are always which image file you load from disk.
No, you shouldn't need two copies of the same image. The #2x scheme is just lets you automatically load a high resolution image when one is available. It sounds like you're already managing your scroll view's content size and things are working, so you can just get rid of the pix#2x.png file.
I'm not sure it's a great UI decision to change the app's behavior based on its screen resolution, though. Since you're already using a scroll view, it can be easy for the user to zoom in and out. Non-retina devices will display at native resolution when zoomed in; retina devices will display at native resolution when zoomed out.

iPhone Image Resolution

I am creating an app that has images in a picker view, but I have noticed that these images appear pixelated. Currently, I have the resolution set at 72 pixels/inch. I have increased it to 300 pixels/inch, but have not noticed a change. Has anyone run into the issue?
If you are creating these images in Photoshop, changing the DPI won't change the image file. A 4x4 image will have 16 pixels. When you change the DPI, it simply changes how large those pixels are on your display. In the case of the retina display, You need to create an image that is double the size (e.g. 8x8).
YOu need to provide the same file as a "#2x" file with double the size. For example, if you have:
myImage.png #32x32
Then you also need:
myImage#2x.png #64x64
When calling the resource, you can use the same way and ignore the #2x part of the filename. IOS will do the right thing. On high density devices, it will choose the bigger file, otherwise it will choose the smaller one.
[UIImage imageNamed:#"myImage.png"]
You dont need the png, but it works with or without it. This code works on all OS's. If it is a retina display, it will use the big image, otherwise not try it.

Image resolution problem in iPhone 4

I am having a problem in iphone 4. The images used in iPhone less than 4 are fine but when I upgraded to iphone 4 the images looks distorted.
Here is the link.
The image size I have used is 320 x 480.
http://img822.imageshack.us/img822/8431/download22.png
Thanks.
The fact is that the resolution of iPhone4 is 960x640 instead that 480x320 so the image is scaled with linear (or bilinear, not sure) filtering.. the result is what you get: a blurry image.
Just redo the image with the proper resolution to solve the problem, you mainly notice these kinds of artifacts because you have rasterized text on an image..
You obtain this effect whenever you resize an image to fit a wider area of pixels: the missing pixels must be filled somehow and filtering comes into play. So you will have to consider also that part of the screen is used by the top bar to have an exact sized picture.
Create a #2x suffix to each of your png that you use.
example:
Icon.png
Icon#2x.png
The runtime environment will choose the double-resolution on retina display devices.
It looks like your original image is 480x320, but you aren't accounting for the fact that the status bar is compressing your image slightly (or perhaps it does on the iPhone4 but on the older iPhones it is cropping instead).
I'd check the image view settings for that background image.