First, we create a new project, and then to localize, localization is based on user-set language and so on information to display. So how to set it, open our project, click on supporting files in the Info.plist.
The first column on the right selects China, so if you encounter some system components, it will automatically become Chinese.
Now let's edit the first page. Add a text box to the storyboard. The simple part I can't, notice here the placeholder (placeholder), represents the display information when you do not enter the content:
There is also this property clear Button, also notice, select appear while editing, on behalf of my input if you do not want to enter the input can be deleted all at once, only when the input will appear.
Automatic layout is my text box automatically adjusts according to the device size, the jargon is called constraints, how to constrain the text box? Mainly to constrain it up and down the distance, we select the text box and then hold down the control key to drag it to the top, select the top Space to the Layout guide, the same left and right drag selection, and then the text box will appear around three lines,
Here's how it works, IP5 and ipad Air, respectively:
You can press the command key on the keyboard + left and RIGHT arrow keys to rotate the screen to try. Then the automatic constraint is implemented.
Swift UI Special training 2 localization and automatic layout