Create a new IOS project step

1. Open Xcode and select Create a new Xcode project

write picture description here

2. Open the template window and select Single View Application

write picture description here

3. Enter the project name, here we use "Helloworld" as an example, and then select Swift in Language

write picture description here

4. Save the project to a local path and choose a directory by yourself.

write picture description here

5. This interface is automatically opened after saving, which contains some settings of the project project, just use the default ones.

write picture description here

6. Click "Main.storyboard" in the directory structure on the left to open the following main interface. This is the default interface when your program is opened.

write picture description here

7. Now add a Button and a Label to the interface, the controls are in the Panel in the lower right corner, and set the Button text to "OK"

write picture description here

8. Next, we need to add a key event to the Button. After pressing the Button, "Hello World!" will be displayed on the Label.
Right-click on the Button control, and click the circle to the right of "Touch Down" under "Sent Events". Pull it to the code area on the right, Xcode will pop up the input box below, enter "o'clock" in "Name", and then connect to create an event

write picture description here

write picture description here

write picture description here

9. Modify the screen size
write picture description here

10. Finally start the test

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325600349&siteId=291194637