Use of UIActivityIndictorView, uiactivity
Main functions:
- It is mainly used in applications to prompt users to execute certain actions in the background, such as network requests and database operations.
Common attributes
UIActivityIndicatorViewStyle activityIndicatorViewStyle; // style setting 1. Hide. incluhideswhenstopped; // hide the view when the stop is enabled. The default value is YESUIColor * color. // modify the color of the indicator. Pay attention to version issues.
Initialization Method-(void) startAnimating; // start animation-(void) stopAnimating; // stop animation-(void) isAnimating; // judge the animation status (YES/NO)
# Import "ViewController. h "@ interface ViewController () @ property (strong, nonatomic) UIActivityIndicatorView * activity; @ end @ implementation ViewController-(void) viewDidLoad {[super viewDidLoad]; _ activity = [[UIActivityIndicatorView alloc] initWithFrame: CGRectMake (0, 0, 40, 40)]; // specify the size of the Progress WHEEL _ activity. center = CGPointMake (160,140); // specify the center of the Progress wheel // set the display type of the Progress wheel [_ activity setActivityIndicatorViewStyle: UIActivityIndicatorViewStyleGray]; [self. view addSubview: _ activity];}-(IBAction) activityButton :( id) sender {-if ([_ activity isAnimating]) {[_ activity stopAnimating]; NSLog (@ "Progress ended");} else {[_ activity startAnimating]; NSLog (@ "progress started") ;}}-(void) didReceiveMemoryWarning {[super didreceivemorywarning]; // Dispose of any resources that can be recreated .} @ end
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.