If you can not watch the above video, you can see it on the youtube URL 4. Select the newly created StackView and click Align icon at the bottom right to add constraints to layout the StackView stay at screen center in both directions. And then you just need to add constraints to the StackView object to create the layout.ģ.1 Select both the button and label together.ģ.2 Click the Embed In icon at the bottom right bar to put the button and label into a StackView. ![]() StackView is a container view, it can group some child view together and freeze them to a block. Now all the source code has been added complete, you can run the example, but when you start it, you will find the button and label layout may not look well, so we need to use the StackView component to group the button and label together to make it’s layout beautiful. Use Stack View To Group Button And Label. Do any additional setup after loading the view, typically from a func onClick(_ sender: UIButton, forEvent event: UIEvent) 3. ViewController.swift //ViewController.swift Input below source code in the ViewController class source file. ![]() Input name label and click Connect button to add a UILabel type instance variable in the ViewController source code. If you can not watch the above video, you can see it on the youtube URL Ĭlick the label view component and press the Control key at the same time, and drag the label to the right side ViewController source code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |