IOS Launch page multi-language
Personal website: Colin's Nest reprint please specify the source.
iOS Development Exchange Group: 184226705. Welcome to Join ~
The launch page is adaptable to multiple languages, so many apps have similar needs. However, before trying the process, found that the "multi-language" of the several implementations, on the Welcome page does not fit, until encountered the UILaunchImages
~ below will describe in detail how to implement the launch page multi-language.
Traditional multi-language settings
Speaking of multiple languages, we have nothing but this realization:
Add multi-lingual support for your App.
Add the corresponding configuration, resources. Like what:
Text:
Image:
Use the corresponding resources, such as:
NSLocalizedString(@"多语言"nil);
A little more trouble, is xib, storyboard multi-lingual. However, the same principle can be achieved in such a way that multi-lingual support. So, it's so simple ~
However, the start page does not seem to eat this set of,,,
Start Page settings
Let's talk about how we set up the startup page.
Assets.xcassets
Before this thing was introduced, we were naming the start page images according to the specification, such as Default, -568h, @2x, @3x and so on, let the system help us to automatically determine the corresponding start page picture.
Assets.xcassets
After that, we have a choice, you can drag and drop the image directly LaunchImage
, and the image name is not so many requirements.
Then, more LaunchScreen.storyboard
, it means that we have more choices, can do more things, it as a xib, drag the relevant controls up to the good ~
Many ways, does it mean that there are many ways to implement multiple languages?
However, it is not,
Whether it's for 图片
multiple languages or LaunchScreen.storyboard
multiple languages, the Discovery launch page never follows the system language, Metrorrhagia.
Of course, the method is not no, just did not find the right ~ The following describes how to UILaunchImages
implement the startup page in multiple languages.
PS: Feel Launchscreen.storyboard is able to do multi-lingual support, is it my implementation process has a problem?
Uilaunchimages
First look at the official documentation:
Uilaunchimages (Array-ios) explicitly specifies the launch images to the app. This key contains an array of dictionaries. Each dictionary contains detailed information on a single launch image and how it is used. Xcode fills in the value of all dictionary based on information your provide in your project settings.
Obviously, we can configure the UILaunchImages
boot image by setting it.
As UILaunchImages
for the several keys, simply describe the following:
UILaunchImageName
(required) Start Page resource Name
UILaunchImageMinimumOSVersion
(required) The minimum supported version of the startup page
UILaunchImageSize
Start Page size
UILaunchImageOrientation
Start Page orientation
?
Representative of what, are relatively simple, specifically can refer to the official documents ~ [Uilaunchimages]
Configuring the startup page in this way is also straightforward, in the following steps:
Cancel the start page using the Asset Catalog
Adding uilaunchimages items in Info.plist
<key>Uilaunchimages</key> <array> <dict> <key>Uilaunchimagename</key> <string>Launchimage</string> <key>Uilaunchimageminimumosversion</key> <string>7.0</string> <key>Uilaunchimagesize</key> <string>{320, 480}</string> <key>Uilaunchimageorientation</key> <string>Portrait</string> </dict> <dict> <key>Uilaunchimagename</key> <string>launchimage-568h</string> <key>Uilaunchimageminimumosversion</key> <string>7.0</string> <key>Uilaunchimagesize</key> <string>{320, 568}</string> <key>Uilaunchimageorientation</key> <string>Portrait</string> </dict> <dict> <key>Uilaunchimagename</key> <string>launchimage-667h</string> <key>Uilaunchimageminimumosversion</key> <string>8.0</string> <key>Uilaunchimagesize</key> <string>{375, 667}</string> <key>Uilaunchimageorientation</key> <string>Portrait</string> </dict> <dict> <key>Uilaunchimagename</key> <string>launchimage-736h</string> <key>Uilaunchimageminimumosversion</key> <string>8.0</string> <key>Uilaunchimagesize</key> <string>{414, 736}</string> <key>Uilaunchimageorientation</key> <string>Portrait</string> </dict> </array>
Add a corresponding startup page resource
?
So, you can complete the launch page multi-language adaptation, do not believe you try it
PS: Here, explain a little. The start page will only keep one copy, that is, after you load the first time, switch the language, and then reopen the app, its startup page will not be updated. This is also in line with Apple's user interaction guidelines.
If you want to dynamically modify the Start Page diagram Launchimage, sorry! based on Apple's user interaction guidelines, this page is displayed when the program loads and is not recommended for dynamic modification.
The right thing to do is to use a fixed image as a starting page diagram and do whatever you want to do after the start 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 executes, but the app may be rejected.
How to set a dynamic start diagram? At the end of the start-up diagram, use a view to show your diagram, and remember that placeholder is set to be the same as your launchimage picture, so you can make a similar effect.
IOS Launch page multi-language