//
// RootViewController.m
// UIActivityIndicatorViewDemo
//
// Created by Dubai on 15/4/28.
// Copyright (c) 2015年 Dubai. All rights reserved.
//
#import"RootViewController.h"
@interface
RootViewController()
@property (strong,
nonatomic) UIActivityIndicatorView *activityIndicator ;
@end
@implementation RootViewController
- (void)viewDidLoad {
[superviewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor= [UIColorwhiteColor];
self.activityIndicator= [[UIActivityIndicatorViewalloc]initWithFrame:CGRectMake(100,100,
60,60)];
[self.viewaddSubview:self.activityIndicator];
self.activityIndicator.activityIndicatorViewStyle=UIActivityIndicatorViewStyleGray;
[self.activityIndicatorstartAnimating];
[NSTimerscheduledTimerWithTimeInterval:3.0ftarget:selfselector:@selector(timerStop)userInfo:nilrepeats:YES];
}
- (void)timerStop
{
[self.activityIndicatorstopAnimating];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
原文:http://blog.csdn.net/zhaoguodongios/article/details/45341727