Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

further customization hooks #12

Open
jdee opened this issue Apr 1, 2014 · 2 comments
Open

further customization hooks #12

jdee opened this issue Apr 1, 2014 · 2 comments
Assignees

Comments

@jdee
Copy link
Owner

jdee commented Apr 1, 2014

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.

  • Background image per state: This is something an app developer cannot easily do with the current control. The control could have new methods backgroundImageForState: and setBackgroundImage:forState: like UIButton. But then shouldn't it also have a configurable background color per state as well, in case you're not using custom images? But UIButton doesn't have this. And currently the knob control has no background. It is transparent, and whatever host view you put it in shows through as the background. Adding a background image per state would probably mean yet a third CALayer.
  • Title(s) per state: Where UIButton has one title to display, the knob control has many, the number specified by the positions property. It's not clear if the titles on the knob should also be configurable per state, since the positions they mark don't change. If this were required, the control would need something like (NSArray_)titlesForState:(UIControlState)state or (NSString_)titleForPositionIndex:(NSInteger)positionIndex andState:(UIControlState)state and a related setter.
@jdee
Copy link
Owner Author

jdee commented Apr 4, 2014

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
Copy link
Owner Author

jdee commented May 30, 2014

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.

@jdee jdee self-assigned this Aug 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant