IOS startup page multi-language explanation
IOS startup page multi-language
The startup page is compatible with multiple languages. Many apps have similar requirements. However, during the previous attempt, we found that the implementation methods of "multi-language" were not suitable on the welcome page until we metUILaunchImages
~ The following describes in detail how to implement the startup page in multiple languages.
Traditional multilingual settings
Speaking of multiple languages, we do nothing like this:
Add multi-language support for the App.
Add the corresponding configuration and resource. For example:
Text:
Image:
Use corresponding resources, such:
Label. text = NSLocalizedString (@ "multilingual", nil );
Another problem is that xib and storyboard have multiple languages. However, the same principle can be achieved in multiple languages. So is that simple ~
However, the startup page does not seem to take this set ,,,
Startup page settings
Let's talk about how to set the startup page.
Assets.xcassets
Before this introduction, we named the boot page images according to the specifications, such as Default,-568 h, @ 2x, @ 3x, etc, let the system automatically determine the corresponding startup page image.
Assets.xcassets
After that, we have a choice, you can drag the image directlyLaunchImage
And there are not many requirements for image naming.
Later, moreLaunchScreen.storyboard
This means that we have more options and can do more things. Use it as an xib and drag and drop related controls ~
There are many ways. Does it mean there are many ways to implement multiple languages?
But not ,,
Whether it isImage
In multiple languages, orLaunchScreen.storyboard
Multi-language, found that the boot page has not followed the system language change, blood collapse ..
Of course, there is no way to do this. I just didn't find the right one ~ The following describes how to useUILaunchImages
Enable multiple languages on the startup page.
PS: I feel that LaunchScreen. storyboard supports multiple languages. Is there a problem in the implementation process?
UILaunchImages
Take a look at the official documentation:
UILaunchImages (Array-iOS) Explicitly specifies the launch images to use for the app. this key contains an array of dictionaries. each dictionary contains detailed information about a single launch image and how it is used. xcode fills in the value of each dictionary based on information you provide in your project settings.
Obviously, we can setUILaunchImages
To configure the startup image.
AsUILaunchImages
Key, which is described as follows:
UILaunchImageName
(Required) launch page Resource Name
UILaunchImageMinimumOSVersion
(Required) the minimum version supported on the startup page
UILaunchImageSize
Startup page size
UILaunchImageOrientation
Start page direction
?
It is easy to represent anything. For details, refer to the official documentation ~ [UILaunchImages]
Configuring the startup page in this way is also very simple. The specific steps are as follows:
Cancel the Asset Catalog used on the startup page
Add UILaunchImages in Info. plist <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4NCjxwcmUgY2xhc3M9 "brush: java;"> UILaunchImages UILaunchImageName LaunchImage UILaunchImageMinimumOSVersion 7.0 UILaunchImageSize {320, 480} UILaunchImageOrientation Portrait UILaunchImageName LaunchImage-568h UILaunchImageMinimumOSVersion 7.0 UILaunchImageSize {320, 568} UILaunchImageOrientation Portrait UILaunchImageName LaunchImage-667h UILaunchImageMinimumOSVersion 8.0 UILaunchImageSize {375, 667} UILaunchImageOrientation Portrait UILaunchImageName LaunchImage-736h UILaunchImageMinimumOSVersion 8.0 UILaunchImageSize {414, 736} UILaunchImageOrientation Portrait
Add the corresponding launch page Resource
?
In this way, the multi-language adaptation of the startup page can be completed. If you don't believe it, try it ~
PS: Here, let's take a look. The startup page will only retain one copy. That is to say, after you load the page for the first time, you switch the language and re-open the App. the startup page will not be updated. This is also in line with Apple's user interaction guidelines.
If you want to dynamically modify the LaunchImage page, sorry!According to Apple's user interaction guide, this page is displayed during program loading and is not recommended to be dynamically modified.
The correct method is generally to use a fixed image to create a startup page, and do whatever you want after the startup page ends.
If you really want to dynamically modify the startup page, the startup page is a fixed name, you can force the page to be replaced after the program is executed, but the APP may be rejected.
How can I set a dynamic startup chart? At the end of the startup graph, use a View to display your animation. Remember to set the placeHolder to be the same as the LaunchImage image, so that you can make similar effects.