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... ");}