This is my code
func drawSmallCircles(){
for oneArray in points {
let startAngleRadiant: CGFloat = degreesToRadians(Double(oneArray[0]))
let endAngleRadiant: CGFloat = degreesToRadians(Double(oneArray[1]))
let radius: CGFloat = 100.0
let path = UIBezierPath(arcCenter: center,
radius: radius,
startAngle: startAngleRadiant,
endAngle: endAngleRadiant,
clockwise: true)
let color = UIColor(red: CGFloat(55), green: CGFloat(37), blue: CGFloat(23), alpha: CGFloat(1))
path.fill()
color.setFill()
path.lineWidth = CGFloat(10)
path.stroke()
setNeedsDisplay()
}
}
as you see, i am having a custom color. my problem is that the color always black.
see
override func drawRect(rect: CGRect) {
self.opaque = false;
drawSmallCircles()
}
this is the drawRec for me
Update1
after Rob answer, this is my code
let points = [[270, 290],[300, 320],[330, 350],[0, 20],[30, 50],[60, 80],[90, 110],[120, 140],[150, 170],[180, 200],[210, 230],[240, 260]]
func drawSmallCircles(){
for oneArray in points {
let startAngleRadiant: CGFloat = degreesToRadians(Double(oneArray[0]))
let endAngleRadiant: CGFloat = degreesToRadians(Double(oneArray[1]))
let radius: CGFloat = 50.0
let path = UIBezierPath(arcCenter: CGPoint(x: CGFloat(100), y: CGFloat(100)),
radius: radius,
startAngle: startAngleRadiant,
endAngle: endAngleRadiant,
clockwise: true)
let color = UIColor(red: CGFloat(55/255), green: CGFloat(37/255), blue: CGFloat(23/255), alpha: CGFloat(1))
// path.fill()
color.setStroke()
path.lineWidth = CGFloat(10)
path.stroke()
// setNeedsDisplay()
}
}
override func drawRect(rect: CGRect) {
self.opaque = false;
drawSmallCircles()
}
but still the same black color,
i did what you said and i called the setStock method on the color and i changed the colors values to 0 between 255