class ViewController: UIViewController,UIActionSheetDelegate{ @IBOutlet weak var label1: UILabel! @IBAction func button1(sender: UIButton) { loading1.startAnimating() } @IBAction func button2(sender: UIButton) { loading1.stopAnimating() } @IBOutlet weak var loading1: UIActivityIndicatorView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }