Because of the company's needs, the request to do an international start page, because the app I also made internationalization, the remaining start page internationalization is not completed, Baidu Ah Google a lot of answers are not satisfactory, and finally see colleagues to complete, I also asked the specific approach, decided to share to the needs of people, lest and I was as anxious, Waste half a day, I realize the effect is either the Chinese version of the display is normal, the English version is not normal, either the Chinese version of the text display Chinese, or the English version of the display of Chinese, anyway, is not the result of demand, and finally draw on the practice of colleagues to solve.
Needless to say, first, you have to prepare a set of pictures:
Probably not, these three pictures 2xhe3x two sets of pictures, a total of six, drag these pictures to assets.xcassets, such as
So you do not have the Chinese and English font name of the picture is called launch. Note that you need to set this noun when setting launch S C reend later.
Set up your new Launchscreen file in Project-target-general-app icons and launch images:
Create a new name for launch screen storyboard, drag Uiimageview into the story version, set the constraints, how much?
And then what? The picture with no English font and no Chinese font is set to ImageView's name launch:
Finally, inside the App de le GA te:
Func application (application:uiapplication, didfinishlaunchingwithoptions launchoptions: [Nsobject:anyobject]?)- > Bool {
Self.window = Uiwindow.init (frame:uiscreen. Mainscreen (). Bounds)
Let login = Uinavigationcontroller.init (Rootviewcontroller:loginviewcontroller ())
Self.window?. Rootviewcontroller = Login
Self.window?. Makekeyandvisible ()
Showlaunchscreen ()
}
Private Func Showlaunchscreen () {
Let launchscreenimg = Uiimageview.init (frame:cgrectmake (0, 0, kscreenwidth, kscreenheight))
Launchscreenimg.image = UIImage (named:nslocalizedstring ("Login_launchscreen", Comment: ""))
window!. Addsubview (LAUNCHSCREENIMG)
Uiview.animatewithduration (0.35, Delay:1, options:. Curveeasein, animations: {
Launchscreenimg.alpha = 0
}) {(finish) in
Launchscreenimg.removefromsuperview ()
}
}
Pay attention to internationalization documents:
"Login_launchscreen" = "chinese.jpg";
"Login_launchscreen" = "english.jpg";
That's it.
swift--Start Page internationalization: Load the start page picture dynamically, load the text when you start