iOS UIActivityIndicatorView

时间:2022-06-01 21:58:07

UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    
    // 设置位置???颜色等
    indicator.tintColor = [UIColor greenColor];
    indicator.color = [UIColor greenColor];
    indicator.backgroundColor = [UIColor blackColor];
    indicator.center = CGPointMake(30, 30);
    indicator.layer.cornerRadius = 18.5;
    indicator.layer.masksToBounds = YES;
    
    UITableViewCell * cell = (UITableViewCell *)[collectionView cellForItemAtIndexPath:indexPath];
    
    [cell addSubview:indicator];
    //开始
    [indicator startAnimating];

  //停止
    [indicator stopAnimating];

  UIActivityIndicatorViewStyleWhiteLarge的尺寸是(37,37)
  UIActivityIndicatorViewStyleWhite的尺寸是(22,22)