Last active
March 3, 2017 04:35
-
-
Save lamarmarshall/f8b930ac4993c77e134f1c007b93f994 to your computer and use it in GitHub Desktop.
swift spinner progressbar indicator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var spinning: Bool = false | |
var spinner = UIActivityIndicatorView() | |
@IBAction func spin(_ sender: Any) { | |
if !spinning { | |
spinner = UIActivityIndicatorView(frame: CGRect(x: 0, y: 0, width: 200, height: 200 ) ) | |
spinner.center = self.view.center | |
spinner.hidesWhenStopped = true | |
spinner.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.gray | |
view.addSubview(spinner) | |
spinner.startAnimating() | |
spinning = true | |
// UIApplication.shared.beginIgnoringInteractionEvents() | |
}else{ | |
spinner.stopAnimating() | |
spinning = false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment