I need to change the color of the UIBezierPath, but if I set a custom color, then there is simply no color.
UIColor(red: 255/255.0, green: 249/255.0, blue: 244/255.0, alpha: 1.0)
Tried adding colors via extension, but there is no color either.
UIColor.themeColor.setFill()
extension UIColor {
class var themeColor: UIColor {
return UIColor(red: 255/255.0, green: 249/255.0, blue: 244/255.0, alpha: 1.0)
}
}
Standard colors like.blue, .green, .red - work, but I need to understand how to set my own color through rgb
Here is my code
class MyView: UIView {
override func draw(_ rect: CGRect) {
let path = UIBezierPath(ovalIn: CGRect(x: 0, y: 0, width: 303.19, height: 495.93))
path.stroke()
}
}
let views = MyView(frame: CGRect(x: 36.62, y: 77.54, width: 303.19, height: 495.93))
views.backgroundColor = .clear
views.rotate(radians: -45.84)
view.addSubview(views)
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.