NSRulerView custom labels
-
Folks
I'm working on an app that will be using timestamps in a NSRulerView -
in the format 0:01, 0:02, et al.
As far as I can determine I can't do this directly by registering a
special unit as there does not appear to be any support for two part
units of this form.
The header file for NSRulerView says:
- (void)drawHashMarksAndLabelsInRect:(NSRect)rect; // You should never
need to call this, but you might want to override it. This method is
called by -drawRect: to draw the actual hash-marks and labels on the
ruler. If you want to do custom hash-marks and labels you should first
look at doing it with a delegate. You can do whatever kind of custom
hash-marks you want through delegation as long as the hash-marks and
labels are evenly spaced. But if you need to do hash-marks or labels
that are not evenly spaced you will need to override this.
However, the only references I can find to the appropriate delegation
on the Internet are four year old posts from someone else asking
exactly the same question.
What should I do in this situation? I've no need to adjust the
existing hash marks, just the displayed labels.
Thanks in advance
Richard -
Richard,
Richard Bannister wrote:
> Folks
>
> I'm working on an app that will be using timestamps in a NSRulerView -
> in the format 0:01, 0:02, et al.
Have you seen this?
http://www.noodlesoft.com/blog/2008/10/05/displaying-line-numbers-with-nste
xtview/
I'm exploring using NSRulerView for labeling stock charts. I think it
should work, unless NSRulerView specifically checks to make sure the
scroll view is a text one.
The Noodle Soft example shows how you can draw horizontal text (line
numbers) on the vertical ruler. I think you can use that approach to
draw your timestamps. I will use it to draw dates and price levels.
Thanks, Joel
---
http://tinyco.de


