Swift 3 如何制作一个圆圈?圆圈应位于中心。确定半径。背景 - blackblur。 谢谢
答案 0 :(得分:10)
为了使圆形绘制一个正方形并添加一个等于width / 2的cornerRadius:
let circle = UIView(frame: CGRect(x: 0.0, y: 0.0, width: 100.0, height: 100.0))
circle.center = self.view.center
circle.layer.cornerRadius = 50
circle.backgroundColor = UIColor.black
circle.clipsToBounds = true
var darkBlur = UIBlurEffect(style: UIBlurEffectStyle.dark)
var blurView = UIVisualEffectView(effect: darkBlur)
blurView.frame = circle.bounds
circle.addSubview(blurView)
self.view.addSubview(circle)
祝你好运! :)