Last active
March 21, 2018 22:03
-
-
Save RockinPaul/8bb5d325d575591bdcef44a87c41b09a to your computer and use it in GitHub Desktop.
This file contains 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
fileprivate var activityIndicator : UIImageView! = UIImageView(image: UIImage.gif(name:"load")) // load.gif file | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.activityIndicator.frame = CGRect(x: 0, y: 0, width: 50, height: 50) | |
self.activityIndicator.contentMode = .scaleAspectFit | |
self.activityIndicator.backgroundColor = UIColor.clear | |
} | |
fileprivate func showActivityIndicator() { | |
self.view.addSubview(self.activityIndicator) | |
self.activityIndicator.center = self.view.center | |
self.activityIndicator.startAnimating() | |
} | |
fileprivate func hideActivityIndicator() { | |
self.activityIndicator.stopAnimating() | |
self.activityIndicator.removeFromSuperview() | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment