Swift - Images Distortion in universal app - ios

I have created iPhone app with a lot of images as interface details. After completion, i decided that i also want to support iPad. So in size classes i chosen REG REG and edited constraints for new device.
Now I have a problem. All images in iPad mode are distorted. Absolutely all. I test on iPad 2 and physical iPad mini. For example I have a png with text
here it is on iPhone 6+
here of iPad2
as you see on iPhone it is smooth, but on iPad pixellizated.
And that happens to all images
Why can this happen ?

As the resolution of both, iPad and iPhone differ from each other, and you are comparing an image of iPhone6+ with iPad, so iPhone6+ will take #3x image while your iPad mini and iPad 2 will take the images of size #2x(if they are retina). So to support the image for iPad you have to add the images for iPad in your images.xcassets folder if your are using the xcassets like this
To get the options for images you have to select your xcassets folder then from the attribute inspector you have to check iPad.

Related

Launch Screen Image size for all iOS screen sizes

I am trying to create a lunch screen image for my iOS app. But I am not sure whats the right size for it.
According to apple website for iPhone 6 the size should be 750 x 1334 (#2x) for portrait.
But my question is, how to create a launch screen image that will fit for all screen sizes such as iPhone 5, 5s, 6, 6 plus, iPads etc?
Whats the correct way of doing this?
Go to images.xcassets
there you can see launch image sizes.Just Enable iOS version from right side.
iPhone Portrait iOS 8:- 1242*2208 (5.5 inch)
750*1334 (4.7 HD)
iPhone Landscape iOS 8:-2208*1242 (5.5inch)
iphone Portrait iOS 7,8 :- 640*960 (#2x)
640*1136 (Retina)
iPhone Portrait 5,6 :- 320*480 (#x)
640*960 (#2x)
640*1136 (retina4)
But my question is, how to create a launch screen image that will fit
for all screen sizes such as iPhone 5, 5s, 6, 6 plus, iPads etc?
That will be very hard to do. The devices have different aspect ratios and the difference in size between say iPhone 5 and iPad Air is pretty big to use one image for all. If you want to use the classical launch screen with a screenshot, resizing one image won't look the same as the user interface on different devices. If you want a launch bitmap image you will need to supply all the necessary sizes.
Whats the correct way of doing this?
You can create either launch PNG image or launch screen as a storyboard.
For launch image, your project has an assets catalog. Either use existing or add new iOS launch image. The editor will show you all required sizes.
For a storyboard, your application probably already has LaunchScreen.storyboard. You typically won't create specific size or sizes here, but use auto layout that will resize the screen appropriately.

How to scale images to different iPhone screen using storyboards?

I am developing an app in which i am displaying certain images such as delete icon,search icon.I have images by names are
delete.png
delete#2x.png
delete#3x.png
I have created images.xcassets & added the images in that for 1x,2x & 3x. Now i have added an UIImageView on story board & it's default image is delete.png(32*32) it runs fine on 3.5 inch screen but images does not scale on 4.7 & 5.5 inch screen iPhone. Can some one please help me out.What to & how to do it?
I thick #Banning and #Fatti Khan suggestion will be the solution of the problem.
Instead of using image name as delete.png use just delete
as a ratio set the images with the exact size as example if the 1x image is 30 px then 2x must be 60px and 3x 90px
1x images are for the original iPhone through the 3GS - 'standard' resolution devices (3.5" screens)
2x images are for the iPhone 4, 4S (3.5" Retina screens) and also iPhone 6.
Retina 4 2x are for the iPhone 5 and 5s (4" Retina screens)
3x images are for the new iPhone 6+ (5.5" super-Retina [3x] screen)
EDIT:
please clean your project and then check again (cmd+shift+k) of delete your derived data.
also check your view is autolayout enable or disable.
or
add The launch image Default-568h#2x.png as i thought your Code unable to detect the different type of screens it have,so follow this steps
First I would like to suggest that,
Preapre all Images,
Select Project from Project Navigator And Go to Summary and scroll down this
screen appears, then right click on that and choose file from your
computer it will automatically copied to project and it will entered
in plist file also..
if your application is universal then you have
to set for iPhone and iPad Both.

How to set the same image for iPhone Retina Display and iPad non Retina

I have developed an universal app and i import my graphics stuff. I came across with the following thought. If the icon that is referred to iPhone retina display and the file that is referred to iPad non retina display has the same size, is there any way not to import the same file with different names (icon#2x.png & icon~ipad.png) twice?
I am not sure if there is such an icon size that would have same size for iPhone retina and iPad non retina device(Pardon me if I am incorrect). If you are talking about any normal image that you want same for iPhone retina and iPad non retina, and you want the app to automatically select the same image for both devices mentioned above then, no. You can manually do that though, which you probably already know.

how to get a normal keypad on iphone 6 and 6 plus

I'm building an app that works fine on iphone 5. When I look at it on a iphone 6 or 6 plus however, I see that the keypad is stretched, basically zoomed in. I'm using autolayout and storyboards.
What do I need to set in order to make the keyboard scale to a normal size?
You need to ensure that the app is optimized to run in the native resolution of these devices, rather than the zoomed compatibility mode. This can be done by setting a properly-sized launch image for the iPhone 6/6+.
These launch images will be labeled Retina HD 4.7 and Retina HD 5.5 in your launch images file, respectively. If you do not see these options available in your launch image assets, create a new launch image set and they should be there.

iOS image size for iPhone and iPad

I am developing universal app for iOS,
I am using Autolayout feature in my app,
I have one doubt:
I want to apply background image in my app,
How many background image i will have to make ??
and what will be the naming conventions of the images ?
so that iPhone automatically takes corresponding images according to device.
Like we gives on launch images, default#2x.png, Default-568h#2x.png, Default-Portrait#2x.png and device automatically understands it's corresponding images.
you need 2 types of images for iphone and ipad.
For ipad you just need to add ~ipad before .png. e.g. image.png for iphone and image~ipad.png for ipad.
Do the same for Retina display images also.
e.g.
iPhone Retina: image#2x.png
iPad Retina: image#2x~ipad.png
What should help in your case is Asset Catalogs, which are by far the best way to manage assets for multiple devices.

Resources