IOS study notes (8) Basic concepts and usage of UIActivityIndicatorView

Source: Internet
Author: User

IOS study notes (8) UIActivityIndicatorView (activity indicator view) (blog address: http://blog.csdn.net/developer_jiangqq)

Author: hmjiangqq

Email: jiangqqlmj@163.com

UIActivityIndicatorView:

Purpose: prompt that the user is loading progress. This control can eliminate psychological events waiting for the user and increase the user experience.

First, let's take a look at the official explanation:


Use an activity indicator to show that a task is in progress. An activity indicator appears as a "gear" that is either spinning or stopped.

You control when an activity indicator animates by callingstartAnimatingAndstopAnimatingMethods. To automatically hide the activity indicator when animation stops, sethidesWhenStoppedPropertyYES.

Common attributes and methods:


-(Void) startAnimating; // start progress Animation

-(Void) stopAnimating; // stop progress Animation

-(BOOL) isAnimating; // checks whether the animation is being executed.

Instance code:

-(BOOL) application :( UIApplication *) application didfinishlaunchingwitexceptions :( NSDictionary *) launchOptions {self. window = [[[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds] autorelease]; // Override point for customization after application launch. self. window. backgroundColor = [UIColor redColor]; UIActivityIndicatorView * activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle: UIActivityIndicatorViewStyleWhiteLarge]; activityView. center = CGPointMake (160,155); [activityView startAnimating]; [self. window addSubview: activityView]; [activityView release]; // automatically stops running [nst1_scheduledtimerwithtimeinterval: 3 target: self selector: @ selector (test :) userInfo: activityView repeats: NO]; [self. window makeKeyAndVisible]; return YES;}-(void) test :( NSTimer *) timer {UIActivityIndicatorView * view = timer. userInfo; [view stopAnimating]; NSLog (@ "Progress ended... ");}



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.