This is the second in a two-part series about a custom color picker. The first post is here.
The bindings had me stumped for a while. I found that for a custom view with its own class, InterfaceBuilder will not let me bind to a variable in that class. The screenshot shows that the view is not one of the allowed options:
So, I put the variables into the AppDelegate. We set the default values in
applicationDidFinishLaunching. The tricky part was to then get the values into the view class in time for the first drawing of the window. I send a message from the AppDelegate to the view instructing it to load, in the same function that sets the defaults.
Also, I didn't like the way the boxes were getting stroked, so I did it myself. I'm not sure if it's really necessary since I've also spread the boxes out a bit now. Anyway, it all looks very stylish, particularly the action of the stepper.