Swift UI Special training 2 localization and automatic layout

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.