Swift UI Special training switch switch

Source: Internet
Author: User

Switches we are familiar with, usually in the use of the iphone is often encountered, mainly used in the program to turn on or disable a setting. Its properties are relatively simple:


Status state: Open or close

What's the color when it's open?

What color is the round button?

When opening and closing, use the picture to make the button background.

As with the previous space practice, we use a label to show the state of the switch.

  @IBAction func SW (sender:uiswitch) {        if (Sender.on)        {            Label1.Text = "On"        } else {            Label1.Text = "Off" c7/>}    }

Let's run a look at the effect:




You can see that the switch is very flashy when switching.

Swift UI Special training switch switch

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.