UIActivityIndicatorView
override func viewDidLoad() { super.viewDidLoad() titleLabel.text = titleString // Do any additional setup after loading the view. //创建活动指示器 var activityView:UIActivityIndicatorView = UIActivityIndicatorView(frame: CGRectMake(, , , )) //添加到视图上 self.view.addSubview(activityView) //启动 activityView.startAnimating() //如果希望指示器停止后自动隐藏,只需要设置hidesWhenStopped属性为YES。默认是YES,设置为NO停止后指示器仍会显示。 activityView.hidesWhenStopped = true //停止 activityView.stopAnimating() //设置属性风格 activityView.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray //获取应用单利 var app:UIApplication = UIApplication.sharedApplication() //设置网络活动指示器加载 app.networkActivityIndicatorVisible = true }