justinmeiners / ios-color-wheel

A fully scalable, dynamically rendered color wheel for iOS.
82 stars 15 forks source link

Float Architecture Problem #4

Closed kpsharp closed 7 years ago

kpsharp commented 10 years ago

In the function setCurrentColor:, the hue, saturation, brightness, and alpha values are initialized as floats, instead of the CGFloats that the getHue: saturation: brightness: alpha: function accepts. This should be changed, as depending on the architecture CGFloats might not be a float (could be a double, for example). This will get the returned values as completely wrong (I was seeing 1.87 and whatnot when I discovered this, which caused the color wheel to look somewhat cool but totally incorrect).

Changing the types to CGFloats fixes this problem.

cprovatas commented 7 years ago

setCurrentColor is not working for me in Swift 3 :( Xcode 8.2. Tried changing floats to CGFloats to no avail. Always sets color wheel in the center

cprovatas commented 7 years ago

scratch that got it work now. For anyone else who may have this issue, if you call setCurrentColor in the viewDidLoad, you may need to call layoutIfNeeded() on your colorWheel before setting the color.