Use of UIActivityIndictorView, uiactivity

Source: Internet
Author: User

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.

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.