문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top