|
From: | Daniel J Farrell |
Subject: | Drawing with NSCell or NSView and reducing -drawRect: clutter? |
Date: | Tue, 21 Aug 2007 01:01:32 +0100 |
Hello, (please see below for the reasoning behind these questions) 1) Can I tell an NSCell to draw paths?2) Is it a good idea to reduce clutter in -drawRect: by using simple helper objects to draw? I would find this aesthetically more pleasing compared to just adding methods to the NSView subclass. As for the former, I can have a one-to-one relationship between custom drawing objects and model objects (see below for more details about this). i.e. a model object is drawn using a corresponding drawing object.
From reading the docs it seems that NSCell is a way to do simple drawing inside a parent NSView. However, it seems to centre around drawing images and text.
What I'm actually doing is trying to draw the axis of a graph. I have a simple model object that describes the axis (tic marks along an axis) and just want a graphical representation of it, e.g. a line with the tic marks at appropriate intervals. Have a look here for the model class, http://www.boyfarrell.com/code/chocplot/doc/
I was hoping to have a simple drawing class that I can initialise with my axis model, such that it will draw in the appropriate place on my NSView.
Cheers, Dan.
[Prev in Thread] | Current Thread | [Next in Thread] |