Question

I want to extend NSSlider class to have an output textfield appended to it. In regards to this I wonder if:

  1. my approach of wanting to append a textfield to NSSlider class is completely wrong and against MVC pattern;
  2. if it is not wrong how should I achieve this? Should I possibly extend NSSlider class with a Category?

Thank you in advance

Was it helpful?

Solution

I wouldn't say that your approach is completely wrong, but it'd probably be easier to create a view (or perhaps a control) that contains both a slider and a text field.

It doesn't sound like you want to change the way the slider displays itself -- you just want a text field next to the slider, and for the value in the field to be tied to the position of the slider, right? If so, composition is the way to go.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top