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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.