I am BRAND NEW to coding. With that said, I have figured out how to put a grey background behind my white activity indicator spinner. Now I want the corners of the background to be rounded. I have searched and searched but I'm not having success.
Here is the code I am using to display the activity indicator and background. If you need more information to help, just ask. I don't really know how to even ask the question. I'm a total rookie.
activityIndicator = UIActivityIndicatorView(frame: CGRectMake(0, 0, 80, 80))
activityIndicator.center = self.view.center
activityIndicator.backgroundColor = (UIColor (white: 0.3, alpha: 0.8)) //create a background behind the spinner
activityIndicator.hidesWhenStopped = true
activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge
view.addSubview(activityIndicator)
activityIndicator.startAnimating()
UIApplication.sharedApplication().beginIgnoringInteractionEvents()
Welcome to Stack Overflow!
In answer to your question: you should set the CALayer
property cornerRadius
to a positive, non-zero value. For example:
activityIndicator.layer.cornerRadius = 10
And the result:
Also, since you're totally new to programming I would recommend you check out Apple's The Swift Programming Language, it's free and takes you through the whole Swift language. Here's the link: https://itunes.apple.com/gb/book/swift-programming-language/id881256329?mt=11 (It's also available just as a Web version)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With