Swift UI Special training Activityindicator

Source: Internet
Author: User

Sometimes our app needs to be connected to the Internet or other time-consuming operations, need to prompt the user, the good way to prompt is the progress bar or a circular gear, prompting the user to have the operation in progress. We add two buttons to the previous scene, download and stop, click to download the gear to start the turn, click Stop to stop.



and drag this component into our scene.



Set Format:



Effect



Connect the buttons and gears to the controller:

@IBOutlet weak var loading:uiactivityindicatorview!    @IBAction func Stopbutton (Sender:uibutton) {    }    @IBAction func Downloadbutton (Sender:uibutton) {    }

The operation of this space is simple, add the following code to the action of the two buttons:

@IBAction func Stopbutton (Sender:uibutton) {        loading.stopanimating ()    }    @IBAction func Downloadbutton ( Sender:uibutton) {        loading.startanimating ()    }

Everyone can try the effect.

Swift UI Special training Activityindicator

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.