xcode6 launch image-assets catalogue - ios

In order to let our universal app to fit to all devices,so that same images of iPhone6 will be scaled on iPhone5 to look the same ,we have added to the project the default launch images,
Default-568h#2x
Default-667h#2x
Default-736h#3x
but the simulator does not scale the images on iPhone5 ,so they look good on the iPhone6 ,but on 5 they cover each other ,because there is no scaling.
I was told to also set them in the assets catalogue in order for the iPhone5 to scale the app images.
But when you open the assets catalogue, you dont have a placeholder for all the above default images i showed here (for iphone5 , 6, 6+) , but just:
iphone portrait(retina and 2x) , and iPad portrait and landscape.
where do you set the Default-568h#2x and Default-667h#2x and Default-736h#3x??
could that be the reason why the iPhone5 is not scaling our app assets ?

Look, you should open attribute inspector, choose options, which you wanna support, then just drag images with required resolution, when you use assets catalogue, names of images are not important, name them as you wish.

Related

Swift - Images Distortion in universal app

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.

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.

Image sizes required to support all iPhone devices

What all splash screen images do we required to create an iOS application? I want to give support all the devices which supports iOS8. Trying to find out working of Images.xcassates and how to add splash images.
I want to support iPhone 4, iPhone 5/5s/5c, iPhone 6/6+, iPad.
What is the naming convention required to set LaunchImage? I just saw 1x, 2x, Retina 4 2x, and 3x in xcassates. But not getting what file names it required.
Like for non retina and and retina we simply twice non retina image for retina and name it like xxx#2x.png for retina and xxx.png for non retina.
Not getting apple document regarding this.
Thank you.
Now in New versions Image name for splash is not required. you can just drag and drop images in "LaunchImage" image asset. Please check below screenshot.
On right side you can see it's required image size in Expected Size : 1242x2208 pixels.
just drag same size image there and you are done.
Maybe this will help you.
There is a default black LaunchImage in xcassets, you jsut have to dragndrop your images into corresponding canvas. XCode will automatically name those images for you.
Note that in xcassets you can choose to see canvas for only iOS 8, iOS 7 or more, iOS 6 or more, etc.
Using image.xcassets, you do not need to follow naming convention. You just drag and drop the image to placeholder inside the image.xcassets. Xcode will handle that for you.
To support multiple device, you can easily match with the naming below the placeholder.
eg.
iPhone Portrait iOS7,8: 2x: iPhone4, Retina 4: iPhone5/5s/5c
For iPhone 6/6+, you can enable iOS8.0 iPhone checkbox on the right panel.
You can also see the expected sizing on the right panel.

#3x images incorrectly used on iPhone 6 or 5S or 5 in XIB's with the "Use as Launch Image" option set

With-in a clean brand new iOS project I've:
added 2 images to the project "background#2x.png" and "background#3x.png"
added a XIB named "LaunchScreen.xib"
checked the XIB's "Use as Launch Screen" option
added a UIView sub-view to LaunchScreen.xib and set its image name to "background.png"
with-in the project settings, under the targets 'General' settings I've set the 'Launch Screen file' to "LaunchScreen"
Now when I launch the app on any of the devices list below the #3x image is displayed in the resulting launch screen when surely the #2x image should be used.
Problem devices (that all use the #3x resource):
iPhone 5 (iOS 8.0.0)
iPhone 6 (iOS 8.0.0)
iPhone 6 (iOS 8.0.2)
iPhone 5 Simulator (iOS 8.0.0)
iPhone 6 Simulator (iOS 8.0.0)
NOTE that the #2x image is distinctive from the #3x image so I can easily identify which one is being used.
At first I assumed this was a bug with the simulator and was staggered when it occurred on a real device also.
I assume this is yet another iOS8 bug however I guess there's also the possibility that its expected behaviour as the result of the launch screen being cached as a static image of some kind.
Any ideas or potential solutions?
EDIT:
For the benefit of others, I have subsequently found that if the images are instead added to an Images.xcassets image set then the correct behaviour is in-fact observed. HOWEVER this is not an ideal solution for us since we have a very specific image export process which means we are not using an Images.xcassets in out project (there are thousands of images in the app).
I have now also raised a Radar with Apple #18513968
http://openradar.appspot.com/18513968
I've just tried this myself, and get the same behaviour you have mentioned.
By setting the Launch Images Source to "Use Asset Catalog", and adding the Launch Image you can get each device to show its specific background. Some screenshots can be seen here:
Supporting iPhone 6 and iPhone 6+ with different launch/splash screen image for iPad Portrait and Landscape orientations
Looking into it a bit more, I found a website that mention:
http://oleb.net/blog/2014/08/replacing-launch-images-with-storyboards/
"You can use the new adaptive UI features in Interface Builder to fit your layout to different screen sizes. If your scene requires screen-size-specific images, use asset catalogs to define different images per size class."
Maybe that is the only way to do it.

Supporting iPhone 6 and iPhone 6+ with different launch/splash screen image for iPad Portrait and Landscape orientations

What I understood from the available documentation and my testing is that
All existing Apps on iPhone 6 and 6 Plus run in compatibility mode,
which means the APIs (like [UIScreen mainScreen].bounds) will
return 320x568 (iPhone 5/5s) still in new iPhones (6/6 Plus) and
all UI is scaled to the correct resolution by iOS.
To support iPhone 6/6Plus we need to create xib for Launch Screen
(File->New->File->UserInterace->Launch Screen) and set the nib file
as "Launch Screen File".
We can set different images for launch screen inside Launch screen nib file based
on avaialble size classes. [Basically combinations of Any, regular
and compact]
There is no way to differentiate between iPad in portrait and iPad
in Landscape orientation (both are regular width regular height).
Also there no way to differentiate between iPhone 4/4s and iPhone
5/s.
Is there a way I can support iPhone 6/6 Plus mode and also provide different launch images for iPad in portrait and iPad in landscape orientation?
See also the similar problem here iOS 8 size classes for iPad landscape
You donĀ“t have to use the launch screen file to make your App iPhone 6 / 6+ resolution compatible. Instead, you can select the LaunchImage asset as your Launch Images Source.
It can be found at "App Icons and Launch Images" under your Targets:
If there is no LaunchImage asset just go to your Images.xcassets, make a secondary click (right click) and select "New Launch Image":
The result is something like that:
Now just drag and drop your images for the specific resolutions you want to support and set the created LaunchImage asset as your source.
Hope it helps
Cheers
Asset catalogues currently work in landscape mode on iPhone on ios8. I had this reponse from apple support:
"There is a bug involving launch images in asset catalogs and apps
that launch in landscape on iPhone. Behind the scenes, the asset
catalog compiler generates the same UILaunchImages key [1] in the
final Info.plist that you would have added when you were specifying
launch images manually. One of the sub-keys for each launch image
specified under the UILaunchImages key is UILaunchImageOrientation
which is always set to Portrait by the asset catalog compiler. This
makes sense because apps on iPhone always launch in portrait
orientation [2]. However, the iOS app launcher decides that since
your UISupportedInterfaceOrientations only contains
UIInterfaceOrientationLandscapeLeft and
UIInterfaceOrientationLandscapeRight, it will only look for landscape
launch images under the UILaunchImages key, of which it finds none.
Since there is no way to force the assets catalog compiler to specify
Landscape for the UILaunchImageOrientation sub-key of iPhone
launch images, you should continue to specify your launch images by
editing the information property list for your app as before."

Resources