I am trying to get my UIActivityIndicator to show on top of everything. Unfortunately, I cannot get it to do so. It shows up like so (actual spinner is on top, but background is behind everything):
It shows behind everything in the view. Here is my code:
var activityIndicator:UIActivityIndicatorView = UIActivityIndicatorView(frame: CGRectMake(0, 0, 150, 150))
self.activityIndicator.center = self.view.center
self.activityIndicator.hidesWhenStopped = true
self.activityIndicator.backgroundColor = (UIColor(white: 0.0, alpha: 0.8))
self.activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge
self.activityIndicator.layer.cornerRadius = 5
view.addSubview(self.activityIndicator)
activityIndicator.startAnimating()
How can I make my activityIndicator background to show up on top of everything (as the spinner is doing so)?
Thanks for all your help in advance!
Cheers!
After adding
self.activityIndicator
to the view hierarchy, you could callview.bringSubviewToFront(self.activityIndicator)
.