Skip to content

Instantly share code, notes, and snippets.

@ahikmatf
Created October 17, 2016 03:42
Show Gist options
  • Save ahikmatf/339ede2bb0cdc5e31fa881268dc996a2 to your computer and use it in GitHub Desktop.
Save ahikmatf/339ede2bb0cdc5e31fa881268dc996a2 to your computer and use it in GitHub Desktop.
for view in self.view.subviews{
print(view)
if view.isKind(of: SpinnerView.self) {
view.removeFromSuperview()
}
}
=====
func showLoading() {
var sizeScale = 1
let model = UIDevice.current.model
if model == "iPhone" {
sizeScale = 1
} else if model == "iPad" {
sizeScale = 2
}
let x = Int(self.view.frame.width / 2) - (18 * sizeScale)
let y = Int(self.view.frame.height / 2) - (18 * sizeScale)
let size = 36 * 2
loadingView = SpinnerView(frame: CGRect(x: x, y: y, width: size, height: size))
loadingView.backgroundColor = UIColor.clear
self.view.addSubview(loadingView)
}
=====
var loadingView = UIView()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment