jdee / ios-knob-control

A generic, reusable knob control for iOS
97 stars 21 forks source link

further customization hooks #12

Open jdee opened 10 years ago

jdee commented 10 years ago

A lot of the interface to the IOSKnobControl class has been based on UIButton, particularly things like imageForState: and titleColorForState:. UIButton has in common with this control that it can use a custom image or images, but if you don't supply any, it will supply a default image using text you provide (in the discrete case) or even default text in the case of the IOSKnobControl. And while it honors the tintColor property and tries to choose a consistent set of colors for different states, you can override all these choices using setTitleColor:forState:, setFillColor:forState and the titles property.

UIButton provides further customization options that may or may not make sense for the IOSKnobControl.

jdee commented 10 years ago

Another option I didn't want to pursue at first, since it seemed heavy, was to have something like an IOSKnobControlDataSource protocol, following the model of UIPickerView, UITableView et al. But this might be a good locus for a lot of configuration options if it is necessary to add many more, rather than proliferating properties and methods on this control for things that are rarely overridden.

jdee commented 10 years ago

Another thing that might be worthwhile would be to have an additional property like titles, called icons or titleIcons or something similar, that would provide an array of UIImage pointers to use along with the text titles in discrete modes. This is similar to the way you can provide a title and an icon for each tab in a tab view, e.g. You can obviously do this with a custom image as well.