Launch screen storyboard for multiple devices and different orientations in iOS - ios

My application supports all devices from 4 inch onwards in both orientations.
iPhone - 5, 5S, 5C, 6, 6S, 6+, 6S+, SE
iPad 4, iPad Air, iPad Air2, iPad Pro etc
Using asset catalog for launch screen its working fine but in iPad Pro app displays standard keyboard rather iPad Pro optimized keyboard which is bigger and doesn't give best user feel.
As per below link app should be using launch storyboard rather than asset images to get optimized iPad Pro native keyboard.
https://forums.developer.apple.com/thread/26357
Now question is how to support both orientations during launch screen storyboard ?
How to add different launch images for portrait and landscape modes in storyboard ? Using size class for iPad in both orientations its both Regular and Regular size.
Note - Because it launches a screen storyboard, one can't customize the size class with custom class.

In your launchsScreen.storyboard add imageView and set it's four constraints like : top,bottom,leading,trailing.
Now, in your assets add separate images for iPhone and iPad with 1x,2x,3x resolution for iPhone and 1x,2x for iPad.
And set that image to that imageview. It will manage then for every device!
You can set different images for different size class in assets. So for different orientation you can set different images in assets.
refer Apple documentation for more details.
And yes you can use vector graphics as suggested in comment by #pkc456 to keep your app light weight.

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.

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 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.

How to set Background image for all iDevice?

I designed one universal application, I want to set image for all iDevice include 1x, 2x, Retina 4 2x, 3x ? How should I do? and how to set for both landscape and portrait. thank in advanced
This naming convention will allow you to get the proper images per device:
image#2x iPhone 4/4s
image-568h#2x iPhone 5/5s
image-667h#2x iPhone 6
image-736h#3x iPhone 6+
This article provides some explanation: http://www.reigndesign.com/blog/preparing-for-the-new-iphone-6-and-iphone-6-plus-screen-sizes/
In terms of changing the image per orientations / orientation change, this post seems to do a good job explaining the necessary calls.
Alternative iOS layouts for portrait and landscape using just one .xib file

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