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