//声明对象
@property ( nonatomic, strong) UIActivityIndicatorView *activityindicator;
self.activityindicator = [[UIActivityIndicatorViewalloc] initWithFrame:CGRectMake(( self.view.frame.size.width-100)/2.0, self.view.frame.size.height/2.0, 100, 100)];
self.activityindicator.backgroundColor = [UIColor colorWithWhite:0.5 alpha:0.5]; //设置风格 self.activityindicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; //一个布尔值,用于控制在动画停止时是否隐藏接收者 self.activityindicator.hidesWhenStopped = YES; //启动 [ self.activityindicator startAnimating]; //暂停 //[ self.activityindicator stopAnimating]; //状态 //self.activityindicator.isAnimating; //设置活动指标的颜色 self.activityindicator.color = [UIColor blueColor]; [ self.view addSubview: self.activityindicator];