UIActivityIndicatorView控件

用处: 菊花图

仅有两个方法:[aiv startAnimating]

       [aiv stopAnimating]

-(void)viewDidLoad

{

  [super viewDidLoad];

  self.aiv = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];

  self.aiv.frame = CGRectMake(20,20,100,100);

  [self.view addSubView:self.aiv];

  

  self.startBtn = [[UIButton alloc]buttonWithType:UIButtonTypeRoundedRect];

  self.startBtn.frame = CGRectMake(20,100,100,50);

  [self.startBtn setTitle:@"start" forState:UIControlStateNormal];

  [self addTarget:self action:@selector(start:) forControlEvents:UIControlEventTouchUpInside];

  [self.view addSubView:self.startBtn];

}

-(IBAction)start:(id)sender

{

  //UIButton* btn = (UIButton*)sender;

  [self.aiv startAnimation];

}

原文地址:https://www.cnblogs.com/AngryCooder/p/3897133.html