iOS development-uiactivityindicatorview Simple to use

Source: Internet
Author: User

software development often encounter half a day to load out the data, whether the program is bad, or the original speed is relatively slow, generally will give a hint to let the user feel that we are trying to load data, iOS can to achieve a similar effect through Uiactivityindicatorview. The Uiactivityindicatorview provides a lightweight view that displays a standard rotation progress wheel, as long as it is added to the program, where start and stop are appropriate. Start can be adsorbed in the current view, stop time will be removed ~

The effect of a simple answer:

Here's how it's implemented:

    Self.activityindicatorview=[[uiactivityindicatorview alloc]initwithframe:cgrectmake (0, 0, +)];    Self.activityindicatorview.center=self.view.center;    [Self.activityindicatorview Setactivityindicatorviewstyle:uiactivityindicatorviewstylegray];    [Self.activityindicatorview Setactivityindicatorviewstyle:uiactivityindicatorviewstylewhitelarge];    [Self.activityindicatorview Setbackgroundcolor:[uicolor Lightgraycolor];    [Self.view AddSubview:self.activityIndicatorView];    [Self.activityindicatorview startanimating];

The code is simple, set frame this needless to say, about the style of the settings, there are three kinds of white and gray, both sizes are 20*20, the large white figure is 37*37:

typedef ns_enum (Nsinteger, Uiactivityindicatorviewstyle) {    uiactivityindicatorviewstylewhitelarge,    Uiactivityindicatorviewstylewhite,    Uiactivityindicatorviewstylegray,};

To turn off animation:

    Dispatch_after (Dispatch_time (Dispatch_time_now, (int64_t) (5* nsec_per_sec)), Dispatch_get_global_queue (DISPATCH_ Queue_priority_default, 0), ^{        [Self.activityindicatorview stopanimating];    });

iOS development-uiactivityindicatorview Simple to use

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.