Dynamic wheel View Control: Uiactivityindicatorview
Description: It is a view control similar to a wheel rotation that can be used as a refresh data when the loading process is used, inheriting from UIView. Type:
typedef ns_enum (Nsinteger, Uiactivityindicatorviewstyle) {
Uiactivityindicatorviewstylewhitelarge, //Large white type
Uiactivityindicatorviewstylewhite, //white type
Uiactivityindicatorviewstylegray, //grey type
};
Property:
@property (nonatomic) Uiactivityindicatorviewstyle Activityindicatorviewstyle; //Type
@property (nonatomic) BOOL hideswhenstopped; //Whether to hide when stopped
@property (ReadWrite, nonatomic, retain) Uicolor *color; //Color
Method:
-(Instancetype) Initwithactivityindicatorstyle: (uiactivityindicatorviewstyle) style; //Initialize method for instance creation
-(void) startanimating; //Start animation
-(void) stopanimating; //Stop animation
-(BOOL) isanimating; //Are you animating
@end
examples are as follows: In method -(void) viewdidload {[Super Viewdidload]; ...} Add the following code
//Create an instance of the active view Control
1 Uiactivityindicatorview *activityview = [[Uiactivityindicatorview alloc]initwithactivityindicatorstyle: Uiactivityindicatorviewstylewhitelarge];
Set the location of the instance
1 Activityview.center = Cgpointmake (;
Set controller view background color
1 [Self.view Setbackgroundcolor:[uicolor Redcolor];
//Add the control to the view
1 [Self.view Addsubview:activityview];
Start animation
1 [ActivityView startanimating];
Sets whether the animation is hidden when stopped
1 activityview.hideswhenstopped = YES;
Use timer to stop animation at 3 seconds
1 [Nstimer scheduledtimerwithtimeinterval:3 target:self selector: @selector (test:) UserInfo: ActivityView Repeats:no];
Start the application's network activity refresh animation
1 UIApplication *app = [uiapplication sharedapplication]; 2 [App Setnetworkactivityindicatorvisible:yes];
#pragma mark-test Timer Events
-(void) Test: (nstimer*) sender{ // Remove the control instance Uiactivityindicatorview * ActivityView = [sender userInfo]; // Stop Animation [ActivityView stopanimating]; // Stop the application's network activity refresh animation UIApplication *app = [uiapplication sharedapplication]; [App Setnetworkactivityindicatorvisible:no];}
Demo Result:
Both of the steam wheels are animated: next to the network, a two-wheel-steamer in the view stops the animation at the timer's point in time:
IOS: Wheel Activity Refresh View Control Uiactivityindicatorview detailed use