How to create a color picker wheel slider?

609 Views Asked by At

Does anyone know how to create the following? I cannot find any tutorials.

I can get the effect without a slider, but it is not as smooth. Or I can incorporate the slider but not update the picker with the value as it expects CGPoints instead of Ints and expects it in the gesture.locationInView(colorWheel) format, which a standard CGPoint will not accept.

what I am trying to create

2

There are 2 best solutions below

0
On BEST ANSWER

I was able to just use the color wheel as a background and used the slider value to change the hue

func changeSet(changeValue: CGFloat) {
    var value = (360 - currentAngleGlobal) / 360 // I had to deduct from 360 as my values were inverted
    var color = UIColor(hue: CGFloat(value), saturation: 1, brightness: 1, alpha: 1)
    self.colorOutput.backgroundColor = color
}
2
On

You can use Cocoa controller for this. There are so much of controllers which is similar to this interface.

https://www.cocoacontrols.com/controls/hsv-color-picker

hope this link will help you.