Reputation: 1740
I was trying to change the color of a UIBezierPath so I copied some reliable code from the Internet, but I got an error which I can't seem to understand. Below is the code and the error. Please help.
override func draw(_ rect: CGRect) {
let skullRadius = min(bounds.width, bounds.height)
let skullCenter = CGPoint(x: bounds.midX, y: bounds.midY)
let skull = UIBezierPath(arcCenter: skullCenter, radius: skullRadius, startAngle: 0.0, endAngle: CGFloat(2*M_PI), clockwise: false)
skull.lineWidth = 3
UIColor.blueColor().setFill()
skull.stroke()
}
Upvotes: 0
Views: 1919
Reputation: 688
you should this code:
override func draw(_ rect: CGRect) {
let skullRadius = min(bounds.width, bounds.height)
let skullCenter = CGPoint(x: bounds.midX, y: bounds.midY)
let skull = UIBezierPath(arcCenter: skullCenter, radius: skullRadius, startAngle: 0.0, endAngle: CGFloat(2*M_PI), clockwise: false)
skull.lineWidth = 3
UIColor.blue.setFill()
skull.stroke()
}
Upvotes: 1